Clarification on Mapping for XMlWriter

Hello,

I have a pipe delimited record in this format:

FirstName|LastName|Phone1|Phone2|Phone3

I want to transform this record to an XML document which looks like this:







Can someone tell me how to write the mappings file for this case?

Thanks much!

Hello Vassanth,

You need to use the following mapping:


<Mapping element="Person" inPort="0" fieldsIgnore="Phone1;Phone2;Phone3;AutoID">
    <Mapping element="PhoneNumbers" inPort="1" key="AutoID" parentKey="AutoID" fieldsIgnore="FirstName;LastName;AutoID"/> 
</Mapping>

You need to read your data by UniversalDataReader, send all data records to SimpleCopy and through its two output ports send these data flows to the input ports of XMLWriter.

All metadata are the same. But remember that you must identify your records uniquely. To do that, add a new field to your metadata (its name is “AutoID” here, its data type is integer, and you must set its Autofilling property to “global_row_count”.) This way all records will be numbered, and these numbers will serve to interconnect both input data flows when output XML structure is created.

Best regards

Tomas Waller