on 12-05-2013 9:37 AM
Hi Mapping Gurus,
This is my source.
Values of <ID> are the unique values of <Blood_ID>.
Footer.item.ID is assigned to a fixed <Group>
So, Blood_ID 1 is under Group X, while Blood_ID 2 is under Group Y.
<root>
<Header>
<item>
<Blood_ID>1</Blood_ID>
<Type>O</Type>
</item>
<item>
<Blood_ID>1</Blood_ID>
<Type>A</Type>
</item>
<item>
<Blood_ID>2</Blood_ID>
<Type>O</Type>
</item>
</Header>
<Footer>
<item>
<ID>1</ID>
<Group>X</Group>
</item>
<item>
<ID>2</ID>
<Group>Y</Group>
</item>
</Footer>
</root>
Based on the logic above, this is the desired target output.
<root>
<list>
<Blood_ID>1</Blood_ID>
<Type>O</Type
<Group>X</Group>
</list>
<list>
<Blood_ID>1</Blood_ID>
<Type>A</Type>
<Group>X</Group>
</list>
<list>
<Blood_ID>2</Blood_ID>
<Type>O</Type>
<Group>Y</Group>
</list>
</root>
Question is, how are we going to map <Group> so that the corresponding <Group> value of the <ID> will be assigned to <Blood_ID>? Are there available functions that can do a correlation?
Appreciate your feedback.
Hi Mark
In Graphical Mapping
use this below mapping
If Blood_ID ( conext Header level ) -->SplitByValueChange--> equals ID ( context item level)
then pass Group of footer ( context item level)
after the IF step use split by each value---> target Group
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mark
Check Below:
I use the folloing UDF with 3 input parameter:
------------------------------------------------
for(int i=0;i<Blood_ID.length;i++)
{
for(int j=0;j<ID.length;j++)
{
if (Blood_ID[i]==ID[j])
{
result.addValue(Group[j]);
}
}
result.addValue(ResultList.CC);
}
----------------------
with Source:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Object_Send_Test xmlns:ns0="http://xyz.com/xi/FccTestEmp">
<root>
<Header>
<item>
<Blood_ID>9</Blood_ID>
<Type>O</Type>
</item>
<item>
<Blood_ID>1</Blood_ID>
<Type>A</Type>
</item>
<item>
<Blood_ID>2</Blood_ID>
<Type>O</Type>
</item>
<item>
<Blood_ID>2</Blood_ID>
<Type>K</Type>
</item>
<item>
<Blood_ID>2</Blood_ID>
<Type>P</Type>
</item>
</Header>
<Footer>
<item>
<ID>1</ID>
<Group>X</Group>
</item>
<item>
<ID>2</ID>
<Group>Y</Group>
</item>
<item>
<ID>9</ID>
<Group>Z</Group>
Z
</item>
</Footer>
</root>
</ns0:MT_Object_Send_Test>
------------------------
Got Target
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Object_Recv_Test xmlns:ns0="http://xyz.com/xi/FccTestEmp"><root><list><Blood_ID>9</Blood_ID><Type>O</Type><Group>Z</Group></list><list><Blood_ID>1</Blood_ID><Type>A</Type><Group>X</Group></list><list><Blood_ID>2</Blood_ID><Type>O</Type><Group>Y</Group></list><list><Blood_ID>2</Blood_ID><Type>K</Type><Group>Y</Group></list><list><Blood_ID>2</Blood_ID><Type>P</Type><Group>Y</Group></list></root></ns0:MT_Object_Recv_Test>
Regards
Gagan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Mark,
in a graphical mapping I think this will be either impossible or too costly to implement. You can try to define a UDF that links the elements. Give it the Blood_ID from Header as input and the Blood_ID and Group from Footer. Then take the first ID, search for a corresponding value in the queue of the second, get the index and take the Group value at that index from Group queue. This is roughly how I'd tackle that problem.
Hope that helps,
Jörg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.