Monday, June 12, 2017

Liquid Data Mapper - Duplicating Nodes

The Liquid Data Mapper makes building complex data transformations quick and easy, but before you start there are a few basic concepts you need to learn.

By default the data mapper diagram will only allow us to connect one data source node connection point to one data target node connection point. In order to connect a second connection point you can add additional duplicate nodes by right clicking on connection point and selecting 'Duplicate'.


Liquid Data Mapper - Duplicating Nodes
Liquid Data Mapper - Duplicating Nodes
In this example, we are copying all the data from our source XML file from 'XML reader 3' to the output 'XML Writer 3', but we also need to take data from a second data source (in this case the second data set are constant values e.g. ‘Joe Bloggs’, but it could just as easily come from another data source such as XML file, Database etc.).

As you can see in the diagram, 'Xml Writer 3' has a Duplicate 'ContactDetails' node allowing us to connect a second data source.

The resulting XML would merge the data from the two data sources and look as follows:

<!--Created by Liquid Data Mapper Libraries (www.liquid-technologies.com)-->
<Contacts>
    <ContactDetails>
        <Name>Aleshia Tomkiewicz</Name>
        <PhoneNumbers>01835-703597</PhoneNumbers>
    </ContactDetails>
    <ContactDetails>
        <Name>Evan Zigomalas</Name>
        <PhoneNumbers>01937-864715 , 01714-737668</PhoneNumbers>
    </ContactDetails>
    <ContactDetails>
        <Name>France Andrade</Name>
        <PhoneNumbers>01347-368222</PhoneNumbers>
    </ContactDetails>
...etc...
    <ContactDetails>
        <Name>Joe Bloggs</Name>
        <Emails>joe@bloggs.com</Emails>
        <PhoneNumbers>0123456789</PhoneNumbers>
    </ContactDetails>
</Contacts>

Notice the last ContactDetails is constructed from our constant data source.


Tip: Execute the transform by pressing Shift-F5.Debug the transform by pressing F5 to start the debugger
    F11 - Step Into
    F9  - Set break point
    F5 - Run (stops on break points)



A free trial of the Liquid Data Mapper is available from:
https://www.liquid-technologies.com/trial-download