How Do I Use Conversion Tables? (Magic xpi 4.13)
Use the Conversion Table and the Convert function to automatically utilize a lookup table when converting data from one vocabulary, or system, to another.
The conversion table can be used as a dynamic lookup table to facilitate automatic data conversion. There are two types of conversion tables:
The Static conversion table is based on a preconfigured flat file data. The conversion data is loaded at server startup. Refresh Conversion is only required if the data of the conversion table file was modified while the server was still running.
To use static conversion tables:
-
In the Solution Explorer, double-click Data Converter, and define a static conversion table.
-
Create a Data Mapper step.
-
Define both the Source and Destination as flat files with several text fields.
-
Map the fields from Source to Destination and use the Convert function where required. The Convert function returns a user string with converted data. It has four input parameters:
-
Convert Table Name
-
Input text (the field to be converted)
-
Default value, which is used when the input field does not exist in the conversion table
-
0/1 case sensitivity indication
In the example below, a dynamic conversion table is used to convert XML elements. The conversion data is stored in a database table, and is loaded into the conversion table at runtime. A dynamic conversion table is defined and loaded into memory using the Refresh Conversion Table service. The dynamic conversion table data is available only in the flow where it is defined, and is erased from memory when the flow terminates.
To use dynamic conversion tables:
-
In the Flat File dialog box, accessed through the Flat File's Properties pane, define a dynamic conversion table as shown below.
-
Create a Data Mapper step to prepare the conversion data.
-
Define the Source as Database type. Define the Destination as Flat File type with two text fields.
-
Map the input fields from the Source to the Destination. The second field in the Destination is the converted value. You can use an expression or additional lookup data to compile the converted value. The Destination file name is a dynamic expression, which is calculated at runtime.
-
Use the Refresh Conversion Table service to refresh the data. The conversion table name is the name defined in the Data Converter Repository. The File Name is the Destination file defined in the preceding Data Mapper step. At this point, the conversion table data is loaded into the memory.
-
Create a Data Mapper step to enable the conversion of the output.
-
Define the Source and the Destination as XML files.
-
Map the required values, as shown below. Use the Convert function that was described in the Static Conversion Tables section.