on 11-01-2006 12:35 PM
Hi,
I have following issue.
I want to map several segments to one with subsegments.
for Example.
Source:
<tag>
<company>SAP</company>
<city>Walldorf</city>
<zip>00000</zip>
<worker_name>Bob</worker_name>
<worker_name2>Boby</worker_name2>
</tag>
<company>SAP</company>
<city>Walldorf</city>
<zip>00000</zip>
<worker_name>Angie</worker_name>
<worker_name2>Smith</worker_name2>
<tag>
<company>SAP</company>
<city>Walldorf</city>
<zip>00000</zip>
<worker_name>Tiger</worker_name>
<worker_name2>Woods</worker_name2>
</tag>
<tag>
<company>Microsoft</company>
<city>Redmond</city>
<zip>00000</zip>
<worker_name>Bill</worker_name>
<worker_name2>Gates</worker_name2>
</tag>
This i want to map to following target structure.
<company>
<company>SAP</company>
<city>Walldorf</city>
<zip>00000</zip>
<worker>
<name1>Bob</name1>
<name2>Boby</name2>
<worker>
<worker>
<name1>Angie</name1>
<name2>Smith</name2>
<worker>
<worker>
<name1>Tiger</name1>
<name2>Woods</name2>
<worker>
</company>
<company>
<company>Microsoft</company>
<city>Redmond</city>
<zip>00000</zip>
<worker>
<name1>Bill</name1>
<name2>Gates</name2>
<worker>
</company>
I hope that helps to understand the issue.
Regards,
Robin
Hi Robin,
You need to play correctly with Context and by using node functions like RemoveContext and SplitByValue.
Have a look on this good doc:
these weblogs:
/people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping
/people/claus.wallacher/blog/2006/08/15/duplicating-subtrees-and-numbering-them-using-the-graphical-mapping-tool
Hope this help you
Mickael
Message was edited by: Mickael Huchet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Here is the mapping:
create <worker> if <worker_name> exist or <worker_name2> exist
<worker_name> - > <name1>
<worker_name2> - > <name2>
regards,
Wojciech
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
But i have for each worker one hole segment with company data.
I have to handle it somehow that i have for maybe three company segments only one with 3 workers in it. How should i do that?
Because it could be that we have different companys.
So i have to check in which company i have to map the workers.
For me it looks not like a simple one to one mapping.
Regards,
Robin
Hi,
I have changed the struc slightly but it works
<HeadTag>
<tag>
<company>SAP</company>
<city>Walldorf</city>
<zip>00000</zip>
<worker_name>Bob</worker_name>
<worker_name2>Boby</worker_name2>
</tag>
<company>SAP</company>
<city>Walldorf</city>
<zip>00000</zip>
<worker_name>Angie</worker_name>
<worker_name2>Smith</worker_name2>
<tag>
<company>SAP</company>
<city>Walldorf</city>
<zip>00000</zip>
<worker_name>Tiger</worker_name>
<worker_name2>Woods</worker_name2>
</tag>
<tag>
<company>Microsoft</company>
<city>Redmond</city>
<zip>00000</zip>
<worker_name>Bill</worker_name>
<worker_name2>Gates</worker_name2>
</tag>
</HeadTag>
destination:
<HeadTag>
<company1>
<company>SAP</company>
<city>Walldorf</city>
<zip>00000</zip>
<worker>
<name1>Bob</name1>
<name2>Boby</name2>
<worker>
<worker>
<name1>Angie</name1>
<name2>Smith</name2>
<worker>
<worker>
<name1>Tiger</name1>
<name2>Woods</name2>
<worker>
</company>
<company>
<company>Microsoft</company>
<city>Redmond</city>
<zip>00000</zip>
<worker>
<name1>Bill</name1>
<name2>Gates</name2>
<worker>
</company1>
</HeadTag>
Mapping:
<company>SplitbyValue(ValueChange)-<company>
<city>SplitbyValue(ValueChange)-<city>
<zip>SplitbyValue(ValueChange)-<zip>
<company>SplitbyValue(ValueChange)-<worker>
In all the above cases context change to Message Type
<name1>direct</name1>
<name2>direct</name2>
check if this works.
Regards
Vijaya
Ohh so you need User defined functions. Inside these functions you should use HashMap object with a company as a key. First assign values to it, and afterwards when you have completed HashMap you can get data in a correct way from it.
http://java.sun.com/j2se/1.4.2/docs/api/java/util/HashMap.html
Regards,
Wojciech
Hi Robin,
It should be mapping one to one. There shouldn't be any problems.
Regards,
Wojciech
Message was edited by: Wojciech Gasiorowski
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.