on 03-14-2007 4:23 PM
Hi everyone.
I'm facing a problem with my mapping.
I have a source structure like this ....
<item>
<POSPRE>444/55555</POSPRE>
<PLURIANUAL>
<EJ_PL>2000</EJ_PL>
<AMOUNT>00</AMOUNT>
</PLURIANUAL>
<PLURIANUAL>
<EJ_PL>2001</EJ_PL>
<AMOUNT>01</AMOUNT>
</PLURIANUAL>
<PLURIANUAL>
<EJ_PL>2001</EJ_PL>
<AMOUNT>01</AMOUNT>
</PLURIANUAL>
.........
.........
.........
<PLURIANUAL>
<EJ_PL>2001</EJ_PL>
<AMOUNT>01</AMOUNT>
</PLURIANUAL>
</item>
As target, i have to have this .......
<item>
<PLURIANUAL>
<EJ_PL>2000</EJ_PL>
<AMOUNT>00</AMOUNT>
<POSPRE>444/55555</POSPRE>
</PLURIANUAL>
<PLURIANUAL>
<EJ_PL>2001</EJ_PL>
<AMOUNT>01</AMOUNT>
<POSPRE>444/55555</POSPRE>
</PLURIANUAL>
.........
.........
.........
<PLURIANUAL>
<EJ_PL>2001</EJ_PL>
<AMOUNT>01</AMOUNT>
<POSPRE>444/55555</POSPRE>
</PLURIANUAL>
</item>
I have no problem mapping fields EJ_PL and AMOUNT but i can't make the correct mapping with field POSPRE.
Anybody knows how to do that?
Regards.
Inigo
Hi again.
Source can have N <PLURIANUAL> occurrences.
In target, i must had the same number of occurrences of the whole source, but adding into each node, the field <POSPRE>.
So, i have a source with N ocurrences of <item>. <item> has a child called <POSPRE> and also, <item> has unbounded childs of <PLURIANUAL>, which has two childs, <EJ_PL> and <AMOUNT>.
Target must be like this ...
Main node, called <item>.
and then, as many as <PLURIANUAL> nodes contained in source node (the whole source). Each <PLURIANUAL> node, has to have the same fields of source with the same values, but adding a new node, called <POSPRE> which is the value of source node <POSPRE> which is son of each item.
understand?
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Inigo -
You can use a simple UDF for the target "POSPRE" field. The UDF should be <i>Cache</i> type of "Context" (radio button) and have 2 arguments (e.g. <i>a</i> for "PLURIANUAL" and <i>b</i> for "POSPRE").
The UDF would be something like:
for (int i=0; i<a.length; i++) {
result.addValue(b[0]);
}
In the graphical mapping, you'd need a <i>SplitByValue</i> right after your UDF.
Regards,
Jin
<u><b>Source</b></u>
<POSPRE>444/55555</POSPRE>
<PLURIANUAL>
<EJ_PL>2000</EJ_PL>
<AMOUNT>00</AMOUNT>
</PLURIANUAL>
<PLURIANUAL>
<EJ_PL>2001</EJ_PL>
<AMOUNT>01</AMOUNT>
</PLURIANUAL>
<PLURIANUAL>
<EJ_PL>2001</EJ_PL>
<AMOUNT>01</AMOUNT>
</PLURIANUAL>
<u><b>Target</b></u>
<PLURIANUAL>
<EJ_PL>2000</EJ_PL>
<AMOUNT>00</AMOUNT>
<POSPRE>444/55555</POSPRE>
</PLURIANUAL>
<PLURIANUAL>
<EJ_PL>2001</EJ_PL>
<AMOUNT>01</AMOUNT>
<POSPRE>444/55555</POSPRE>
</PLURIANUAL>
Build your target structure to look like this:
<PLURIANUAL> 1..unlimited
<EJ_PL></EJ_PL> 1:1
<AMOUNT></AMOUNT> 1:1
<POSPRE></POSPRE>1:1
</PLURIANUAL>
Then you want to map as follows:
<b>(source)</b> <POSPRE> to <b>(target)</b> <POSPRE>
<b>(source)</b> <EJ_PL> splitByValue <b>(target)</b> </EJ_PL>
<b>(source)</b> <AMOUNT> splitByValue <b>(target)</b> <AMOUNT>
I'm doing this without looking at XI so the mapping could be off a bit. You will definitely need to do context changes, which can be acheived through splitByValue (among several other standard graphical functions) or through writing Java user defined functions. I did somethig similar with UDF's in this weblog:
/people/harrison.holland5/blog/2006/12/08/mapping-context-changes-in-xi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hey
watever i can make out from your structure,i think u need to duplicate subtree on the receiver side.
on the sender side u have one entry for <POSPRE> and on receiver side u have two entries for that,is this the problem?
thanx
ahmad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I dont see your problem could you elaborate a little on what you are trying to achieve
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.