Universal data exchange
Suppose that Jack of All Trades established a branch in town N, and installed a configuration identical to yours to manage the branch operations.
You need to establish data exchange between these two databases, so that each database stores full information about materials and services, while accounting and payroll are managed independently in each database.
To do so, you will create an exchange plan, specify which data is included in the exchange, and create a number of procedures that write exchange files to the hard disk and load data from these exchange files.
To simplify the example, you will not develop any automatic file exchange between the two databases. Instead, you will start the exchange procedure manually.
Before you start programming the exchange algorithm, let us discuss some enhancements that you need to make in your database to prepare it for the exchange.
These enhancements are related to the fact that, up to this point, you have only worked with a single database, and have relied on uniqueness of catalog code numbers and document numbers. Now, new catalog items and new documents will be created independently in two databases at the same time, and you still need to ensure uniqueness of catalog item code numbers and document numbers, but this time it’s across two databases.
If you do not do that, there can be a situation when new documents created in both infobases have identical numbers. This will cause a data exchange conflict because the platform attempts to write a document to the database using a number that is already used by another document.
To prevent such situations, let us add a unique prefix that unambiguously identifies the database to document numbers and catalog codes.
Hence even if the numbers of new documents in the two databases match, they will still have different prefixes and no conflict will occur.
You will use the Constant configuration object to store number prefixes.