Skip to Content
author's profile photo Former Member
Former Member

Simply repeat nodes in target but with main sorter node around them

Hi,

This is nice:

Source message containing nodes:

<main1>

<field 1>123 </field>

<field 2>ABC </field>

</main1>

<main1> ...

<main2> ....

<main2>

<main2>

<main3>

<main4>

<main1>

<field 1>567<ield>

<field 2>DGFfield>

<main1>

<main1>

<main2>

<main2>

<main3>

<main4>

<main4>

....

Each node contains two fields that identify nodes belonging together (and some fields).

Message simply needs to be copied to target message.....

BUT: All nodes incl their fields need to be grouped within a new main node (here: <TARGET> by criteria of same field1 and field2 IDs.

And of course nodes are defined 0...unbounded and same node (e.g. main1) can be repeated for the same IDs field1 and field 2.

So result has to be:

<TARGET> (for field1 = 123, field 2 = ABC )

<main1>

<field 1>123 </field>

<field 2>ABC </field>

</main1>

<main1>

<field 1>123 </field>

<field 2>ABC </field>

</main1>

...

<main2> ....

<field 1>123 </field>

<field 2>ABC </field>

</main2>

<main2>.....

<main2>

<main3>

<main4>

</TARGET>

<TARGET> (for field1 = 567, field 2 = DGF )

<main1>

<field 1>567</field>

<field 2>DGF</field>

<main1>

<main1>

<main2>

<main2>

<main3>

<main4>

<main4>

</TARGET>

....

Is there a possible solution for that using graphical mapping (and e.g. using some UDF if required)?

Regards

Dirk

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jun 26, 2012 at 02:48 PM

    Hi,

    Please try with the below logic.

    concat(field1,field2)-->removecontext-->sort-->splitByValuechange-->collapseContext-->Target

    concat(field1,field2)-->removecontext-->sort-->splitByValuechange-->main1/main2

    concat(field1,field2)-->removecontext-->sort-->splitByEachValue-->SubString(0,3)-->filed1

    concat(field1,field2)-->removecontext-->sort-->splitByEachValue-->SubString(3,3)-->field2

    Regards,
    Priyanka

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Priyanka,

      this is an idea that is moving me one step forward, but only one step.

      Target ist created as often as expected (2 targets).

      But main1 is created (appears 6 times, 3 for each ID combination) only once for each target.

      And... first main1 is sorted to first target, second (with same ID is sorted to second target.

      Other 4 are lost.

      regards

      Dirk

  • Posted on Jun 26, 2012 at 03:01 PM

    Hi Dirk,

    In fact, I would approach it with a simple XSLT mapping, for sorting purposes. See below how to perform sorting:

    http://www.w3schools.com/xsl/xsl_sort.asp

    And my favourite try-it online test tool:

    http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog

    Below, please find an stylesheet edited to sort by two fields. I believe you should be able to achieve your requirement with a similar approach. Let me know if you find difficulties with some particular part.

    Regards,

    Greg


    stylesheet.png (20.8 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 26, 2012 at 04:03 PM

    Its not possible to achive this requirement using Standard mapping,use XSLT.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 27, 2012 at 06:46 AM

    Hello Meinhard,

    Could you give us an actual example of the input/expected ouput so that we can visualize it better?

    Regards,
    Mark

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.