Description
A DocToDoc config defines the part of data which will be transferred from a source document to a target one. Through the config you can manage the rules when and what data will be transferred between the two documents. Moreover, you can add the post-calculation for a target document that will be performed just after the transferring. The config also supports the multiple transfer multi-to-one that means the values of source document is being placed to values list of target one.
A DocToDoc config consists from its items. Type each item on new line. A config's item can define the data for transfer ( transfer's item ) or call other DocToDoc config ( link's item ). The items of both types can be typed in a config DocToDoc at the same time.
You can address to a config DocToDoc from a config item DocUpDoc and some public functions of the library DocExtLib.
Adding
To create a config DocToDoc perform:
• | Open the view Configs \ DocToDoc and in its actions bar press Create DocToDoc Config; |
• | On the opened form in the field Name type the config name without spaces. It must be unique name among all DocToDoc configs. Using the name you can address to the config from a code and from other configs; |
• | At the right define whether the config is enabled or not. To a config not marked as enabled you can not address at all; |
• | In the field Description type text about the config. For example - From Company to Contract. It's help info that will not be used anywhere; |
• | In the fields Version set the number and date of the config version. It's help info that will not be used anywhere. |
Item's Format
An item can consist from prefix part, main part and target's part. Only main part is always required.
[ Prefix part ] Main part [ Target part ]
Prefix part
The prefix part defines whether the transfer data are the defaults or the transfer is multi-to-one or adds other DocToDoc config to the current. It's defined by the tags:
DFT - means the transfer data are defaults and not will be updated after the transferring if the source document is changed or deleted. It relates to updating through a DocUpDoc config where the DocToDoc config is used. In a code you can control it with function's input value of a used function.
MLT - means that value of source document is placed in values list of target document ( the multi-to-one transfer ). Use the tag if you want to place values from more than one source document into one target document. You can type the tag in more than one config item.
KEY - matters only if the tag MLT in the config item is applied. Means that the source value is key value among all values transferring to the values list of target. All together the transfer items in a config with the tag KEY must provide the uniqueness for the values transferred by the items into target document at adding or updating. Otherwise the DocToDoc config will not be processed and the message box about the error will be displayed.
D2D - means an other DocToDoc config will be added to the current config. If you use the DFT, MLT, KEY it will be applied to all items of the added DocToDoc config. In the added config you also can use the tag D2D to add an other config and so on.
COPY - means the copying a whole field instead of the transferring its value from source document into target one. The tag matters only at item of transferring data between the same fields of source and
TYPE[T] - means the transforming of field of target document into specified type at data transfer. The parameter T can have one of the values: A - field type Authors, R - field type Readers, N - field type Names, D - field type Date/Time only with date without time. The tag matters only if the tags D2D and MLT are not used in the config item.
Main part
The main part of a config's item defines what data of source document ( source for short ) and to what field of target document ( target for short ) will be transferred. Use one of possible format, when typing the main part of a DocToDoc config item:
name - means the name of identical fields of source and target or the name of an other DocToDoc config if the tag D2D is typed. Just type the name of a field or a config.
SRC{ formula } - means the computing the name of identical fields of source and target or the name of an other DocToDoc config if the tag D2D is typed. Type a formula that will be computed on source to get the name of a field or a config.
TRG{ formula } - means the computing the name of identical fields of source and target or the name of an other DocToDoc config if the tag D2D is typed. Type a formula that will be computed on target to get the name of a field or a config.
BOTH{ formula } - means the computing the name of identical fields of source and target or the name of an other DocToDoc config if the tag D2D is typed. Type a formula that will be computed the both on source and on target at the same time to get the name of a field or a config. Inside the formula type the tags SRC[ name ] and TRG[ name ] to use values of the fields with the specified names in source and in target accordingly. A result got by a tag SRC or TRG will always be a text enclosed in quotes. If the result will be a list, each its element will be enclosed in quotes with separating the list elements by colon between themselves to represent them in the format of text list in Formula Language.
All tags described below can be used only if the tag D2D was not typed in the config item.
name1 or { formula } >> name2 - means the fields' names of source and target are not identical or instead a field's name of source is used an formula. Type a field's name or a formula ( in the brackets ) of source at the left of ">>" and a field's name of target at the right.
name or { formula } >> SRC{ formula } - means the field's name of target will be computed on source. Type a field's name or a formula ( in the brackets ) of source at the left of ">>" and an formula in the tag SRC{ } at the right that will be computed on source to get the field's name of target.
name or { formula } >> TRG{ formula } - means the field's name of target will be computed on target itself. Type a field's name or a formula ( in the brackets ) of source at the left of ">>" and an formula in the tag TRG{ } at the right that will be computed on target to get its field's name.
name or { formula } >> BOTH{ formula } - means the field's name of target will be computed both on source and on target at the same time. Type a field's name or a formula ( in the brackets ) of source at the left of ">>" and a formula in the tag BOTH{ } at the right that will be computed both on source and on target at the same time to get the field's name of the target. How is working the tag BOTH{ } is described a bit above.
In all cases when a formula is used to compute the name of a target's field or an other config DocToDoc, the empty text as result means that the config item will not be applied.
Target part
After the main part of DocToDoc item you can type the target's part in the following format:
D4D[ name ] - means that instead of the changed value of the source document will be used values list from the documents got for the target document by the config item DocForDoc with the name. You also can type the tag D4D{ formula } to compute the name of a DocForDoc config item on target document. If the source document is not new it must be among the got documents, otherwise it cause the error. You can leave the list of values as result or process it with tag { formula } typed next. If the tag D2D has been typed in the prefix part of a config item, the tag D4D to all items of the added DocToDoc config will be applied.
{ formula } - means the formula in the brackets will be computed on target and the result becomes the value its field. Matters only for an item without the tag D2D. The computation occurs only if the value of source defined in the config item was changed. The transfer of value of source to field of target before the formula computing will be done only at presence of the name of the field in the formula ( case sensitive ).
FAIL{ condition } - defines when the result of the transfer causes the fail. Type in the formula the name of field changed by the item as well as other fields names of target if it is required. Matters only for an item without the tag D2D. The formula result @True (1) or any not empty text will cause the error with message box and stops the transfer by the config. If the DocToDoc config is called from a DocUpDoc item of DocExt config before a source document is being saved the update process of related target documents will be stopped and the method Update ( DocExt class ) returns False (0).
Topic links:
See also: