Import templates

Import templates follow the same general principles as export templates, with the flow of data going in the opposite direction.

An import template maps data elements in an import file to keywords, which in turn map the data elements to business object properties and ultimately to the correct tables and columns in the database.

A key difference is that the data in the import file isn’t necessarily XML, so the import template needs some other way to identify data elements and map them to keywords. Sometimes the import file uses a fixed length data format, where each row contains a single record to be imported, and specific pieces of data are displayed in specific positions within the row. For example, a sample data section from an import template is shown below.

<ROW _ROWSTARTTAG="1">
<PAYMENTS _ITERATOR="IdPayment">
<PAYMENT>
<CUSTOMER_NO>
<IdPayment.KW_Hansen.Billing_Payment_AccountNumber _STARTPOSITION="2" _LENGTH="29" />
</CUSTOMER_NO>
<AMOUNT>
<IdPayment.KW_Hansen.Billing_Payment_Amount _STARTPOSITION="32" _LENGTH="11" />
</AMOUNT>
</PAYMENT>
</PAYMENTS>
</ROW>

The ROWSTARTTAG attribute indicates the character that marks the beginning of each row—in this case a 1. A sample row from the import file is shown below, with the opening character color coded to match the ROWSTARTTAG attribute. The account number and the payment amount are identified by their starting positions and lengths. In the example below, the account number starts at position 2 and is 29 characters long. The spaces are counted. The payment amount starts at position 32 and is 11 character long.

1ACCACCOUNTNUMBER B00000001000CV000TIDDVoucherBPay

Another option is to use a specific character as a delimiter between data elements. In that case you only need to specify which character is used to delimit the columns in the import string.