on 05-28-2015 11:46 AM
Hello,
My requirement is to split a list of incoming items into three lists of outgoing items:
Input:
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>
<name>a</name>
<color>blue</color>
<size>xl</size>
</item>
<item>
<name>c</name>
<color>yellow</color>
<size>xxl</size>
</item>
<item>
<name>b</name>
<color>blue</color>
<size>l</size>
</item>
<item>
<name>c</name>
<color>blue</color>
<size>m</size>
</item>
<item>
<name>a</name>
<color>red</color>
<size>xl</size>
</item>
<item>
<name>d</name>
<color>red</color>
<size>s</size>
</item>
</items>
expected output:
<?xml version="1.0" encoding="UTF-8"?>
<items>
<blueItems>
<item>
<name>a</name>
<color>blue</color>
<size>xl</size>
</item>
<item>
<name>b</name>
<color>blue</color>
<size>l</size>
</item>
<item>
<name>c</name>
<color>blue</color>
<size>m</size>
</item>
</blueItems>
<yellowItems>
<item>
<name>c</name>
<color>yellow</color>
<size>xxl</size>
</item>
</yellowItems>
<redItems>
<item>
<name>a</name>
<color>red</color>
<size>xl</size>
</item>
<item>
<name>d</name>
<color>red</color>
<size>s</size>
</item>
</redItems>
</items>
So I have a list that needs to be split by a condition. Is this possible to achieve with graphical mapping or do we have to use UDF in this case?
Hi Peter ,
For every top node i.e. Blueitems , YellowItems and red items you can put a condition for CREATEIF when the color is Blue , Yellow and Red respectively.
You may need to handle some context for achieving this but it is possible.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess this link -
http://wiki.scn.sap.com/wiki/display/XI/Split+Mapping+using+UDF
would help, though with UDF
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there Peter,
If the split occures based on the value provided in the color field I beleive this is possbile
but you'll need to use sort and splitByValue.
you might need to use more then 1 mapping program (you can run them one by one inside the operation mapping).
I beleive it will be possible to perform it without a UDF but mind you that you re-structure the paylod
and this might have buisness effects on your solution (if a context in a message is needed)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.