Exportizer Users' Guide vlsoftware.net

Field Mappings File

Contents Index Previous Next

Field mappings files contain source-to-target field mappings for export operations. Use them whenever you need the same field mappings to be used more than once.

It is supported two formats of field mappings files: XML (recommended) and plain text.

XML format

This format is flexible and extendable and therefore is recommended to use whenever possible. Each mapping must contain the source attributes with at least FieldName specified and the target attributes with variable number of attributes:

Target attribute Target Format Description
FieldName All Specifies the physical name of the target field (column). Required attribute.
FieldType Database, SQL Specifies the type of the target field (column). For SQL databases, it should be a SQL type supported by the target database. For non-SQL databases (e.g. ASCII tables) it should be a type supported by the target database.
FieldSize Database, SQL Specifies the maximum number of characters for text fields (columns) or total number of digits for fields (columns) holding floating-point numbers.
FieldScale Database, SQL Specifies the scale (number of digits to the right of the decimal point) for fields (columns) holding floating-point numbers.

Such files can be created either in the Export dialog on the Field Mappings step or manually using a text editor. When creating the files manually please note that they must conform to XML standards and contain byte order marks at the beginning if needed.

Example of the Access-to-Oracle field mappings file in XML format:

<?xml version="1.0" encoding="UTF-8"?>
<-- Source-to-Target mappings for Payments aggregation -->
<FieldMappings>
  <Items>
    <FieldMapping>
      <Source>
        <FieldName>Department</FieldName>
      </Source>
      <Target>
        <FieldName>DEPARTMENT</FieldName>
        <FieldType>VARCHAR2</FieldType>
        <FieldSize>20</FieldSize>
      </Target>
    <FieldMapping>
      <Source>
        <FieldName>ActualityDate</FieldName>
      </Source>
      <Target>
        <FieldName>ACTUALITY_DATE</FieldName>
        <FieldType>DATE</FieldType>
      </Target>
    </FieldMapping>
    <FieldMapping>
      <Source>
        <FieldName>PaymentCount</FieldName>
      </Source>
      <Target>
        <FieldName>PAYMENT_COUNT</FieldName>
        <FieldType>INTEGER</FieldType>
      </Target>
    </FieldMapping>
    <FieldMapping>
      <Source>
        <FieldName>PaymentSum</FieldName>
      </Source>
      <Target>
        <FieldName>PAYMENT_SUM</FieldName>
        <FieldType>NUMERIC</FieldType>
        <FieldPrecision>12</FieldPrecision>
        <FieldScale>2</FieldScale>
      </Target>
    </FieldMapping>
    <FieldMapping>
      <Source>
        <!-- dynamic expressions are possible: -->
        <FieldName>vle_expr(0.1 * dataset_field_val(1, 'PaymentSum'))</FieldName>
      </Source>
      <Target>
        <FieldName>COMMISSION_SUM</FieldName>
        <FieldType>NUMERIC</FieldType>
        <FieldPrecision>12</FieldPrecision>
        <FieldScale>2</FieldScale>
      </Target>
    </FieldMapping>
  </Items>
</FieldMappings>

Text format

Such files consist of series of SourceFieldName=TargetFieldName pairs, one mapping per line. It is recommended that field names not contain equal signs. Instead of source field names, dynamic expressions can be used (see example below). Lines with a semicolon at the beginning are ignored as comments. Blank lines are allowed.

Such files can have any extension and can be created in any text editor. When creating the files please include byte order marks at the beginning if needed.

Example of the field mappings file in text format:

;Source-to-Target mappings for Payments aggregation
Department=DEPARTMENT
ActualityDate=ACTUALITY_DATE
PaymentCount=PAYMENT_COUNT
PaymentSum=PAYMENT_SUM
;dynamic expressions are possible:
vle_expr(0.1 * dataset_field_val(1, 'PaymentSum'))=COMMISSION_SUM

Notes
Target FieldName attributes, if contain characters, uncommon for field names in the target database (i.e. spaces etc.), should be enclosed in double quotes or square brackets according to the rules of the target database.