Database Tour Documentation Contents Index

Table Mappings File

 

Table mappings files contain source-to-target table mappings for multi-table export operations. Use them whenever you need the same table mappings to be used more than once. They can be also used when exporting data from command line or action files.

It is supported two formats of table 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 TableName specified and the target attributes with variable number of attributes.

Such files can be created either in the Export dialog on the Table 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.

Source attributes

DatasetType

Specifies the source dataset type. Possible values: Table, SQLFile, SQLText. If this attribute is omitted, other source attributes are used to identify the dataset type.

DatasetTitle

Specifies the source dataset title. It is sometimes used in GUI as a caption of the corresponding data window.

TableName

Specifies a source table name.

SQLFile

Specifies a path to file with text of the source SQL query.

SQLText

Specifies the text of a source SQL query.

Target attributes

TableName

For Database target format, it specifies a table name to export data to. For SQL target format, it specifies a table name to be used in generated SQL commands.

Target formats: Database, SQL

FileName

File name to export data to.

Target formats: All except Database

TableDescription

Description for target table. Currently, it can be applied to Oracle, SQL Server, PostgreSQL, and MySQL databases. For Database target format, the description is applied only to table, which is created during the export operation. For SQL target format, the description is applied only with Add DDL option.

Target formats: Database, SQL

SQLStatementType

Type of SQL command (i.e. INSERT, UPDATE, DELETE etc.) to be applied for the current table. This attribute overrides the corresponding option common for all tables.

Target formats: SQL

ExportMode

Export mode to be applied to the current table or file. This attribute overrides the corresponding option common for all tables (files).

Target formats: All

RecordLogFileName

File name to write the record log output to. Currently, this attribute must be filled manually in the table mappings file. Use it when you need a separate record log instead of specifying a common record log for all tables.

Target formats: All

BadRecordLogFileName

File name to write the bad record log output to. Currently, this attribute must be filled manually in the table mappings file. Use it when you need a separate record log instead of specifying a common record log for all tables.

Target formats: All

HtmlDocTitle

The text to be placed into HTML Title tag.

Target formats: HTML

HtmlTableId

The text to be placed into id attribute of HTML Table tag.

Target formats: HTML

TableTitle

The text to be placed above the table data in the target document.

Target formats: HTML, RTF, Excel (XLSX), Excel (XML based)

HtmlStepNo

Current export step.

Target formats: HTML

SheetName

The name of sheet to place the table data in.

Target formats: Excel (XLSX)

Field mappings

FieldMappings

Optional source-to-target field mappings. If omitted, the field mappings for the table are built automatically based on fields of the source table and the target table (if it exists).

XML Format Example

Example of the table mappings file in XML format:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Source-to-Target table mappings for Orders database -->
<TableMappings>
  <Items>
    <TableMapping>
      <Source>
        <TableName>customer.dbf</TableName>
      </Source>
      <Target>
        <FileName>customer.html</FileName>
        <TableTitle>Customers</TableTitle>
        <HtmlDocTitle>customers</HtmlDocTitle>
        <HtmlTableId>customer</HtmlTableId>
        <HtmlStepNo>1</HtmlStepNo>
      </Target>
      <FieldMappings>
        <Items>
          <FieldMapping>
            <Source>
              <FieldName>CustId</FieldName>
            </Source>
            <Target>
              <FieldName>Customer Id</FieldName>
            </Target>
          </FieldMapping>
          <FieldMapping>
            <Source>
              <FieldName>CustName</FieldName>
            </Source>
            <Target>
              <FieldName>Customer Name</FieldName>
            </Target>
          </FieldMapping>
        </Items>
      </FieldMappings>
    </TableMapping>
    <TableMapping>
      <Source>
        <TableName>order.dbf</TableName>
      </Source>
      <Target>
        <FileName>order.html</FileName>
        <TableTitle>Orders</TableTitle>
        <HtmlDocTitle>orders</HtmlDocTitle>
        <HtmlTableId>order</HtmlTableId>
        <HtmlStepNo>2</HtmlStepNo>
      </Target>
    </TableMapping>
    <TableMapping>
      <Source>
        <TableName>payment.dbf</TableName>
      </Source>
      <Target>
        <FileName>payment.html</FileName>
        <TableTitle>Payments</TableTitle>
        <HtmlDocTitle>payments</HtmlDocTitle>
        <HtmlTableId>payment</HtmlTableId>
        <HtmlStepNo>3</HtmlStepNo>
      </Target>
    </TableMapping>
  </Items>
</TableMappings>

Text Format

Such files consist of series of SourceTableName = TargetTableOrFileName pairs, one mapping per line. It is recommended that table (file) names not contain equal signs. 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.

Text Format Example

Example of the table mappings file in text format:

;Source-to-Target table mappings for Orders database
Customer=Customer.htm
Order=Order.htm
Payment=Payment.htm