Wednesday, June 14, 2017

Liquid Data Mapper - Dynamic Data Sources

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.

It is possible to load data source documents from a URL that is calculated at runtime. These include XML documents, JSON documents, CSV files, and EDI documents.

This makes it possible to open associated files based on data in other files or to process all the files in a folder.


Liquid Data Mapper - Dynamic Data Sources
Liquid Data Mapper - Dynamic Data Sources

This simple example shows how to open two XML files 'ContactList.part1.xml'  and 'ContactList.part2.xml', and combine their contents. Although the filenames come from 'Constant' component values in this example, they could just as easily be values read from another data source.

ListFiles Component


Liquid Data Mapper - Dynamic Data Sources
Liquid Data Mapper - Dynamic Data Sources

This second example shows how to combine all the files in the folder “..\..\Data Files” that match the pattern “ContactList.part*.xml” (relative paths are resolved relative to the transform).

These settings can be edited by selecting the 'ListFiles 1' component and looking at the properties window.
Liquid Data Mapper - ListFiles Component Properties
Liquid Data Mapper - 'ListFiles' Component Properties

In both of the above examples, the first XML document 'ContactList.part1.xml' contains eight 'ContactDetails' elements and the second XML document 'ContactList.part2.xml' contains twelve 'ContactDetails' elements. When you run the transform, the resulting output contains all twenty 'ContactDetails' elements.

<!--Created by Liquid Data Mapper Libraries (www.liquid-technologies.com)-->
<Contacts>
    <ContactDetails>
        <Name>Aleshia Tomkiewicz</Name>
        <Emails>atomkiewicz@hotmail.com</Emails>
        <PhoneNumbers>01835-703597</PhoneNumbers>
    </ContactDetails>
    <ContactDetails>
        <Name>Evan Zigomalas</Name>
        <Emails>evan.zigomalas@gmail.com</Emails>
        <PhoneNumbers>01937-864715, 01714-737668</PhoneNumbers>
    </ContactDetails>
    <ContactDetails>
        <Name>France Andrade</Name>
        <Emails>france.andrade@hotmail.com</Emails>
        <PhoneNumbers>01347-368222</PhoneNumbers>
    </ContactDetails>
    <ContactDetails>
        <Name>Ulysses Mcwalters</Name>
        <Emails>ulysses@hotmail.com</Emails>
        <PhoneNumbers>01912-771311, 01302-601380</PhoneNumbers>
    </ContactDetails>
    <ContactDetails>
        <Name>Tyisha Veness</Name>
        <Emails>tyisha.veness@hotmail.com</Emails>
        <PhoneNumbers>01547-429341, 01290-367248</PhoneNumbers>
    </ContactDetails>
    <ContactDetails>
        <Name>Eric Rampy</Name>
        <Emails>erampy@rampy.co.uk</Emails>
        <PhoneNumbers>01969-886290, 01545-817375</PhoneNumbers>
    </ContactDetails>
    ...etc...
</Contacts>


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