Step 5 Map the Input xml to the Target Database

LANSA Composer

Step 5. Map the Input xml to the Target Database

LIC003 - Create a Transformation Map

You now have an input xml layout and target database tables in the mapping workspace. In this step you need to make known the connections between the input and target and to identify calculations and additional input.

1.  Connect the SalesOrder to the TUTORDH file.

This connection specifies that an order header database record will be created for each <SalesOrder> element encountered in the input XML.

To make the connection, click and hold down the left-mouse button on the SalesOrder element, drag the mouse to the right, over the connector arrow adjacent to the TUTORDH file.  As you drag the mouse, a connector line will be drawn.  When the mouse is over the TUTORDH connector, the mouse pointer will change.  Release the left mouse button to complete the connection.

2.  Similarly, connect the Line to the TUTORDL file.

This connection specifies that an order detail database record will be created for each <Line> element encountered in the input XML.

3.  Now connect the data items as follows:

4.  The field Line Value LINVAL in table TUTORDL is to be derived by a calculation.

a.  Add a multiply function from the Math functions shown on the Libraries tab.

b.  Set the inputs (value 1 and 2) as the Price and Quantity from the input order.

c.  Assign the result to the LINVAL field.

5.  The field BCHNUM in the tables is a batch number. This does not exist in the input but will be provided to the Transformation Map at run-time via a parameter value.

a.  To set up the mapping for this batch number, select Insert Input from the Function menu.

b.  Set the Name to BatchNumber and Type to string

c.  Give the batch number a default value of iii123. This will enable the Output tab in MapForce to show a preview of the transformation.

6.  Connect the resulting BatchNumber to the BCHNUM in tables TUTORDH and TUTORDL.

7.  You may click on the Output tab to view how the data from the sample input would be added to the database tables. Note that, for the purpose of the preview, the field BCHNUM has the default value you gave it above. At execution time its value will come from a parameter value.

8.  Save your map and exit from MapForce.