LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  XML Data Sort the output

    Employee
    Posted 05-25-2015 01:11

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: cristi.boizas

    Hi,

    I am using a XML Data Node for reading an XML file and I must transpose the content into a csv file . Example:

    <ProductList>
    <id>1</id>
    <brand>100</brand>
    <name>Mobile</name>
    <subproductList occurence="Optional">
    <id>1</id>
    <subname>Internet</subname>
    <subproductList occurence="Mandatory">
    <id>2</id>
    <subname>SMS</subname>
    <ProducList>

    I am trying to obtain something like:

    Product_ID | Product_Brand | Product_Name | SubProduct_Occurence | SubProduct_Id | SubProduct_Name
    1|100|Mobile|1|Optional|Internet
    1|100|Mobile|2|Mandatory|SMS


    The columns are received from a configuration list in a DB table Like : Name - Product_Id, Type: NUMBER, Length: 10 , Position: 1

    The problem I am currently having is that the XML outputs the data dinamically and does not arrange the columns in the way they appear in the file so, I can get the Product_Id on either position 1 , or 4 . The checks I perform use a loop and use the column position to identify the appropriate column, so is there a way to make the XML Data node output the data in the order it finds the tags in the input XML file ?


  • 2.  RE: XML Data Sort the output

    Employee
    Posted 05-25-2015 01:29

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Tim Meagher

    Hi,

    This is not currently possible using the XML Data node.

    Within LAE metadata, the column ordering is not important and not guaranteed for a lot of nodes, however for this case of wanting to then output to an external system, the column ordering is then important in the external system (CSV), and this sort of thing cannot be handled via the XML file.
    Often within an XML file, the ordering of fields is not important within XML as well and can change from record to record.
    I guess in such cases, an additional parameter would be needed to specify what action to take if the fields are not always in the same order.
    Still, it should be possible to enhance the node to at least try and preserve the order of the fields as seen in the data.
    This has been raised as an enhancement request with the ID: LAL-4750.

    At the moment, I think the only workaround would be to determine the field ordering yourself and then apply that ordering after the data has been imported using the Change Metadata node.
    The following posts outline how the Change Metadata node can be used for this purpose:
    http://community.lavastorm.com/threa...-left-to-right
    http://community.lavastorm.com/threa...6-Sort-Columns

    Regards,
    Tim.