cancel
Showing results for 
Search instead for 
Did you mean: 

How to create n nodes from m target nodes?

Former Member
0 Kudos

Hi,

back to mapping...

A message provides such content:

<Message>

<main>

  <sub>1234</sub>

  <low>ABC</low>

</main>

<main>

  <sub>1234</sub>

<low>ABC</low>

</main>

<main>

  <sub>3456</sub>

<low>BCD</low>

</main>

<main>

  <sub>3456</sub>

<low>BCD</low>

</main>

<main>

  <sub>3456</sub>

<low>BCM</low>

</main>

</Message>

For each <sub>/<low> combination I need to create one target node....

<Message2>

<target>

<value>1234</value>

  <low>ABC</low>

</target>

<target>

<value>3456</value>

<low>BCD</low>

</target>

<target>

<value>3456</value>

<low>BCM</low>

</target>

</Message2>

Maybe this is too simple but I am stuck......

Your help is welcome....

Regards

Dirk

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Sub

--------concat----removecontext---splitbyvalue(value change)---collapsecontext----target

Low

For the fields u can use below mapping:

Thanks

Amit Srivastava

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

thank you!

It works with this:

concat -> remove Context -> splitByValue(Value Change) -> collapseContexts -> target

It was the added <sort> that killed me.

 

Regards

Dirk

former_member184681
Active Contributor
0 Kudos

Dear Dirk,

For the subnodes and fields, you could try using somehow similar logic, together with sortByKey function. I mean, your fields could be sorted by the results of:

X = value (context: Message), low (context: Message) -> concat (separator ":") -> sort -> splitByValue(Value Change)

So use this sort of mapping:

field1 -> sortByKey (X) -> target1

Regards,

Greg

former_member184681
Active Contributor
0 Kudos

Hi Dirk,

The concat function could be a solution for you:

value (context: Message), low (context: Message) -> concat (separator ":") -> sort -> splitByValue(Value Change) -> removeContexts -> target

Regards,

Greg

gagandeep_batra
Active Contributor
0 Kudos

Hi Dirk,

So Sub and low  field is your key field so first concate them then use the following logic which is describe in following thread

http://scn.sap.com/thread/3190674

Regards

Gagandeep