on 09-22-2009 10:42 AM
Hello!
I have message type with structure like this:
<mt>
<element>
<priority>1</priority>
<key>xxx</key>
</element>
<element>
<priority>2</priority>
<key>yyy</key>
</element>
<element>
<priority>3</priority>
<key>zzz</key>
</element>
</mt>
The element occurence is ounbounded. The target structure is the same, but I need only one element with the highest prioruty - in my example - the first element with priority 1.
I need to compare prioritys of all elements.
How can I do this?
Do the mapping as
priority----->removeContext--->sort(Ascending)---->collapseContext--->Element
priority----->removeContext--->sort(Ascending)---->collapseContext--->priority
priority----->removeContext--\
--------->sortByKey---->collapseContext--->key
key----->removeContext----/.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can compare and get the highest priority easly as mentioned by Suraj, but the problem will come when you map the key field.
To get the correct key associated with highest priority, you need to store the highest priority in some variable and when doing the mapping for key field just compare the variable value with highest priority and if it is true then only map the key value to target field.
Regards,
Sarvesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You can use SORT API in mapping to define the priority based on asending or decending order
Thanks
Swarup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andrey,
Use sortByKey function followed by collapseContext function.
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Do like this
Priority (context element)> sort (ascending)>CollapseContext-->target field
Regards
Suraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can apply sort function on priority element as explained in Stefan's blog.
/people/stefan.grube/blog/2005/12/29/new-functions-in-the-graphical-mapping-tool-xi-30-sp13
Regards,
Sunil Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.