Universal data exchange in xml format 7.7. Appearance and features of using universal data exchange

And this article describes the steps required to exchange data from a 1C:Enterprise configuration version 7.7 to 8.2 using the same configuration Data conversion, edition 2.1.4.1.

Let's find the processing file MD82Exp.epf as part of the data conversion configuration distribution kit.
It will be needed to download the description of the receiver base configuration metadata structure.

We will also find the processing file V8Exchan82.epf as part of the same distribution kit - “ universal exchange data in XML format.
It will be needed to unload the receiver base. As the name implies, these treatments are intended
to work with version 1C:Enterprise 8.2.

Then we will find tools for working with the 1C:Enterprise 7.7 version.

The distribution kit of the Data conversion configuration contains the processing file MD77Exp.ert.
It will be needed to download the description of the source database configuration metadata structure.

We will also find the V77Exp.ert processing file as part of the same distribution kit - “Universal data upload in XML format”.
It will be needed to unload the source database.

So let's get started:

First, let's unload the descriptions of the source and destination metadata structure.

  1. Let's open the source database in 1C:Enterprise 7.7 mode and start processing MD77Exp.ert
    to download the description of the source metadata structure.
    Save the source metadata structure to the Rules1.xml file.
  2. Let's open the receiver base in 1C:Enterprise 8.2 mode and start processing MD82Exp.epf
    to download the description of the receiver's metadata structure.
    Let's save the receiver's metadata structure to the Rules2.xml file.

Let's load descriptions of the metadata structure of both configurations.

  1. Let's run the Data conversion configuration in 1C:Enterprise 8.2 mode.
  2. Open the “Configurations” directory (Directories—>Configurations). It stores configuration information,
    between which exchange rules can be configured.
  3. Let's add configuration information to the source. Click the "Add" button or the "Insert" key.
  4. Specify the path to the file with the source metadata structure Rules1.xml. Click the "Download" button.
  5. Let's add information about the configuration of the receiver. Click the "Add" button or the "Insert" key.
  6. Specify the path to the file with the receiver metadata structure Rules2.xml. Click the "Download" button.

So, we have loaded the source and destination information. Now we can configure the exchange rules.

  1. Open the “Conversions” directory (Directories—>Conversions). This handbook contains information
    in which it is determined between which configurations the exchange is carried out and in which direction.
  2. Let's add a new element. Click the "Add" button or the "Insert" key.
  3. Specify the source configuration from the "Configurations" directory. The "Configuration - Source:" field.
  4. Specify the receiver configuration from the "Configurations" directory. Field "Configuration - receiver:".
  5. Important detail!!! Open the "Advanced" tab. The "Unload module file name:" field.
  6. Specify the location of the unload module file, for example: C:\\Bases\\Unload Module.txt.
  7. The contents of this file are needed so that in the future (more on this below) to replace the entire
    module in processing V77Exp.ert. Unloading is impossible without this replacement!
  8. Let's press the "OK" button.

Great, we have configured the exchange rules. It remains to upload these exchange rules to a file.

  1. In the "Conversions" directory, select the newly created element.
  2. On the reference panel, click the "Go to Rules" button. A form with conversion rules will open.
  3. In the "Data upload rules" tab, we indicate what exactly we want to upload.
  4. On the "Property Conversion" tab, we can specify the mapping of the attributes of the exchanging objects.
  5. On this form in the upper left corner we will find the "Save rules" button.
  6. Specify the file name and path (For example, C:\\Bases\\Data Exchange Rules.xml). Let's press the "Open" button.
  7. Later, specified path we can change in the directory "Conversions" -\u003e "Change the current element (F2)" -\u003e the tab "Advanced" -\u003e the field "File name of the exchange rules:".
  8. While saving the rules, the unloading module is also written to the path we specified earlier: C:\\Bases\\Unloading Module.txt.

Conversion rules are ready! Now let's do the data exchange.

Let's open the source database in 1C:Configurator 7.7 mode, then open the V77Exp.ert processing -
"Universal Data Export in XML Format". Open the "Module" tab, delete all the contents of the module.
Insert the line: #LoadFromFile C:\\Bases\\UploadModule.txt.

With the "LoadFromFile" directive, we switch the download software module to load from a text file.
Now we need to make sure that the file with the upload code Upload Module.txt is always in the folder we specified.

Save the V77Exp.ert processing.

To upload data, you must:

  1. Open the source database in 1C:Enterprise 7.7 mode, then open the just saved processing V77Exp.ert.
  2. Specify the name of the exchange rules file in the "Rules file name:" field (we saved it here: C:\\Bases\\DataExchangeRules.xml) and
    select a file in the "Data file name:" field to which the data will be uploaded (For example, C:\\Bases\\Uploading DataFrom 7.7.xml).
  3. Next, you need to download the exchange rules by clicking the "Download exchange rules" button.
  4. To upload documents for a certain interval, you must specify the period - "Start Date" and "End Date".
  5. The checkboxes in the "Data Upload Rules" list indicate which data will be uploaded and which will not.

Now let's load the data into the receiver database. Let's open it in 1C:Enterprise 8.2 mode and start processing
"XML Generic Data Exchange" to load source data.

This is the processing file V8Exchan82.epf. Or open "Tools"—>"Other data exchanges"—>"Universal data exchange in XML format"

  1. In the processing, on the “Data Loading” tab, select the name of the data file (we saved it here: C:\\Bases\\Uploading DataFrom 7.7.xml).
  2. Click the "Load Data" button (Located on the panel at the top).

Data loaded!

The same steps for unloading from version 1C:Enterprise 7.7 are applicable for versions 1C:Enterprise 8.1 and 1C:Enterprise 8.0.
As part of the configuration distribution kit Data conversion are
processing files for these versions MD81Exp.epf and V8Exchan81.epf, MD80Exp.epf and V8Exchan.epf.

If you want to upload data to 1C:Enterprise 7.7, then you need to use V77Imp.ert processing.
Before loading data, you must perform the same actions with the V77Imp.ert processing module that were described
to process V77Exp.ert.

If you choose processing from the list quick access(File - V77Exp.ert) and a message is displayed that the file was not found,
although the file is located in the same place and the name has not changed, then you just need to do everything as in the beginning -
File | Open" and select the V77Exp.ert file again.

Today we will review with you processing "Universal unloading in XML for 1s 7.7". This processing is designed to upload data according to the exchange rules to an XML file. The rules for uploading data are also an XML file, which contains a description of what data and in what structure should be uploaded to the XML file.

How to use the processing of universal unloading in XML for 1s 7.7?

Below in the screenshot you see the main form of processing universal unloading in XML for 1s 7.7, let's look at the main parameters that are necessary for it correct operation. Where the number 1 stands, we indicate the file with the rules for uploading data, for which we need these rules, we already said in the first paragraph of the article. For number 2, select the file where the data will be uploaded. In paragraph 3, you must specify the start date and end date, for this period the data will be uploaded to the file. After we have specified all these parameters, click "Load rules", after reading the rules in paragraph 5, a tree structure of the exchange rules file with the name of the rules will appear. Now all we have to do is press the button in our processing universal unloading XML 1s 7.7 under the number 6 "Upload", after this action all data will be uploaded according to the current rules for uploading data to the XML file that we specified in paragraph 2.

Here I will describe the main points when working with a standard component v7plus.dll. The information is very outdated, and it appeared here more for myself - so as not to forget the next time it appears. Reading from an XML file by means of an XML parser of an almost standard component is described. An example is the file of an application document uploaded to a file in the CommerceML 2.03 format (from the site on Bitrix).

So let's start. The first step is to load the component. Here is a typical code:

If + "v7plus.dll")<>1 Then If LoadExternalComponent(CatalogIB()+ "ExtForms\" + "v7plus.dll")<>1 Then If LoadExternalComponent(ProgramDirectory()+ "v7plus.dll")<>1 Then Warning("Component v7plus.dll not found!"); Return; EndIf; EndIf; EndIf; Parser = CreateObject("AddIn.XMLParser");

The analyzer can work with circuits, but I will not consider this point. Simple linear (well, or almost linear) file reading. So we just create new document:

XML_Document = Parser . CreateDocument(); If EmptyValue( XML_Document ) = 1 Then Return EndIf; XML_Document . Load(Filename);

In a variable File name a string is written with the name of the file to be opened. After that, you can read the file, gradually decrypting it.
An XML file consists of nodes and attributes. Each node can contain zero or more attributes and zero or more child nodes. The root node can be obtained directly from the variable XML_Document. For clarity, consider part of the XML file:

<КоммерческаяИнформация ВерсияСхемы=»2.03″ ДатаФормирования=»2014-04-09 14:25″>
<Документ>
<Ид>53006
<Номер>53006
<Дата>2014-04-29
<ХозОперация>Goods order
<Роль>Salesman
<Валюта>rub
<Курс>1
<Сумма>300000.00
<Контрагенты>…
<Время>11:52
<Комментарий>TEST…….BSV
<Товары>
<Товар>
<Ид>ID46
<Наименование>…
<БазоваяЕдиница Код=»796″ НаименованиеПолное=»Штука» МеждународноеСокращение=»PCE»>PC

Here is a greatly reduced version of the file, or rather, part of it. The purpose of this article is not to describe the CommerceML format, but to show how to work with an XML file, so I will only give commands. A CommerceML file consists of a root node " CommercialInformation". We read it from the document:

ElDocument = XML_Document . SelectNode("CommercialInformation");

Variable value ElDocument there will be a node (OLE object). It has child nodes and attributes. There can be several documents in one file, so we loop through them:

Selection = ElDocument. Select Nodes("Document"); For d = 1 By Sample. Number of Nodes Loop Doc = Selection . GetNode(th - 1);

Property Number of Nodes returns the total number of child nodes, and the method GetNode() returns the specified child node (numbered from 0).

Knot " Number' has neither attributes nor child nodes. It only matters " 00006 ". Likewise " date of«, « HozOperation" and many others. The following construction is used to get the value of a node:

Number = Doc. Select Node ("Number"). Meaning ; NumberNumber = Number(Doc .SelectNode("Number"). Value );

Here is the method used SelectNode(). Unlike " SelectNodes()", it does not return a list, but the very first node with the given name. And its property Meaning' returns a string with a value. To convert a value to the desired type, we use the conversion functions. The date will have to be converted in parts (it is stored in XML as yyyy-mm-dd, which is not supported by the standard Date() function). It is possible that when using schemas, type conversion will be performed automatically - did not check.
The following method is used to read attributes:

OKEI = Product . SelectNode("BasicUnit"). GetAttribute("The code");

Here Product is the node Product". The value of an attribute, like a single child node, can be retrieved from the attribute name. A string is always returned, so if necessary, you need to cast the value type to the required one. If a node needs to read several attributes, it is better to store the value of the node in a separate variable.
Well, that's all the basic functions needed to fully read XML files.

Work with the XML files from 1C: Accounting 7.7

Quite often, in the work of large enterprises and retail chains, there is a need to exchange data between databases. Each programmer and administrator solves this issue differently. Someone writes uploads and downloads through intermediate table files, someone uses the mode COM connections to connect to the source database. However, recently, its own 1C mechanism called "Universal Data Exchange in XML Format" is gaining more and more popularity.

Processing Appearance

In the Full interface, you can open the processing at Tools->Other data exchanges-> Universal data exchange in XML format.

The processing form (Fig.1) contains four tabs:

  • Additional settings;
  • Deleting data.
  • The interface of each of the tabs is heavily loaded with elements, and therefore requires separate consideration.

    Data upload

    At the very top of the tab there is a field for selecting the exchange rules file. For non-standard databases and exchanges, you will have to create the exchange file yourself.

    There are two radio buttons on the next line of the form:

    1. Uploading to an exchange file (Fig. 2);
    2. Connecting and uploading data to IB (Fig. 3).

    As you can see from the figures above, depending on the radio button, the appearance of the form is different. If the file exchange option is selected, the user is prompted to select the location of the file where the upload will be performed and the possibility of compressing it to save space and protect it with a password.

    The option of direct connection to the receiving base supports both file and client-server modes of operation. In this case, it will be necessary to register the address of the base, fill in the fields "User" and "Password". Before you start exchanging data, it is advisable to test the connection.

    tabular part located below allows you to configure selections and other upload parameters.

    To debug algorithms and correct errors, you can use the mechanism built into the exchange processing. It is activated by setting the corresponding checkbox at the bottom of the form. Clicking on the “Debug Settings…” button brings up a window (Fig. 4).

    Fig.4

    hallmark this form is informative help on the left side of the layout, which describes each of the three possible debugging modes. As a file external processing any epf file can act with the module.

    Clicking on the "Finish" button checks the correctness and completeness of the filled data.

    Unlike "Upload", this tab (Fig. 5) does not have a tabular section, but there are many more checkboxes that allow you to adjust the parameters for recording new and changed objects.

    Fig.5

    First of all, you need to select a file that will serve as a source of information. This can be done in the "File name to upload" input field. If the data was uploaded to a password-protected archive, it will need to be entered in the appropriate field.

    The corresponding checkboxes allow you to configure:

    • Transaction when writing objects (this sometimes speeds up the process);
    • Loading data in the exchange mode (in this case, all platform checks, with the exception of checking when posting documents, will be ignored during recording);
    • Overwriting changed elements;
    • Setting a deletion flag for downloaded items;
    • The mode of writing new data to the register (either one by one or in a set);
    • Trimming non-significant characters (spaces and tabs) for string values.

    Additional settings

    As is clear from the name of the tab, it contains tools, the use of which allows you to fine-tune the exchange process. In particular:

    1. Enables debug mode;
    2. Allows you to use the transaction in the upload process;
    3. Optimizes the exchange between databases of the 8th version of 1C;
    4. Unload only those objects that are allowed for use by the current user;
    5. Enable logging of the exchange process between databases.

    These and some other functions are enabled by setting the appropriate checkboxes on the form (Fig. 6).

    Fig.6

    Deleting data

    This tab is only used by developers in debug mode. Allows you to delete unnecessary objects from the database.

    Briefly about setting up exchange rules

    Using a standard handler makes life much easier for programmers. At the same time, one of the most difficult moments for someone who first encountered "Universal Data Exchange in XML Format" is the question: "Where can I get the exchange rules file?".

    First of all, for the independent production of exchange rules, a special configuration is required, which is called "Data Conversion". It contains several interesting files that allow you to configure almost any exchange between various 1C 7 and 8 databases:

    1. epf - needed to unload the metadata structure for 1C 8 databases;
    2. epf - if the 1C 8 configuration is self-written or non-standard, it may not have the “Universal Data Exchange” processing, this file is this processing;
    3. ert - file contains code for unloading the metadata structure of 1C versions 7.7 configurations;
    4. ert - processing file for uploading and downloading data for the seven.

    Having launched the appropriate processing, it is necessary to unload the metadata structures for the source database and the destination database. Then, in the "Conversion" configuration, you must enter information about the configurations of the source and receiver into the "Configurations" directory.

    Then, an element containing information about the direction of data exchange is created in the Conversion directory. You can set Exchange Rules for it.

    Share