on 04-22-2009 4:42 PM
Hi folks.
I have to follow source XML to map to receiver XML:
source
....
<SERVICE>
<SRVNR>1001</SRVNR>
<MATERIAL>
<MATNR>QWERT</MATNR>
</MATERIAL>
<MATERIAL>
<MATNR>ASDFG</MATNR>
</MATERIAL>
</SERVICE>
<SERVICE>
<SRVNR>2002</SRVNR>
</SERVICE>
<SERVICE>
<SRVNR>3003</SRVNR>
<MATERIAL>
<MATNR>ZXCVB</MATNR>
</MATERIAL>
</SERVICE>
....
receiver must be as follow
....
<MATERIAL>
<SRVNR>1001</SRVNR>
<MATNR>QWERT</MATNR>
</MATERIAL>
<MATERIAL>
<SRVNR>1001</SRVNR>
<MATNR>ASDFG</MATNR>
</MATERIAL>
<MATERIAL>
<SRVNR>3003</SRVNR>
<MATNR>ZXCVB</MATNR>
</MATERIAL>
....
but the result is below
<MATERIAL>
<SRVNR>1001</SRVNR>
<MATNR>QWERT</MATNR>
</MATERIAL>
<MATERIAL>
<SRVNR>2002</SRVNR>
<MATNR>ASDFG</MATNR>
</MATERIAL>
<MATERIAL>
<SRVNR>3003</SRVNR>
<MATNR>ZXCVB</MATNR>
</MATERIAL>
I've tried the code below:
for (int i=0; i<a.length;i++){
result.addValue(b[0]);
}
where the parameter a is my root <MATERIAL> and the parameter b is element <SRVNR>, but the result is wrong.
I've tried node function useOneAsMany but doesn't work too.
My difficult is associate root <SERVER> with corresponding roots <MATERIAL> in the result using either a node function or an user define function.
Someone can help me, please?
Thanks in advanced.
I got a answer for you... replicated same scenario in my IR, could test that and it is working great..
do you want me to send screen shots? or I can explain it to you..
fields are mapped like this;
Step 1)
MATNR ---> removeContexts --->MATERIAL
where MATNR context is changed to SERVICE
Step 2)
SRVNR -
MATERIAL -
MATNR -
in the same order all 3 fields go to -
again MATNR context is changed to SERVICE
Step 3)
MATNR ---> SplitByValue(Each Value) -
again MATNR context is changed to SERVICE ..
this should work for you.. please do try.. I have invested time to do this )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prema.
I delayed to answer to you because your tip is was almost what I needed, but with it I got the solution.
I've never done an useOneAsMany function with a context instead of elements as you suggest.
My scenario it was a little more complex then I wrote, but now it's solved.
Thank you so much for the tip!
?
Edited by: Wolfgang Disch on Apr 28, 2009 5:30 PM
Edited by: Wolfgang Disch on Apr 28, 2009 5:45 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ss
Edited by: Wolfgang Disch on Apr 28, 2009 5:45 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
under node functions you can use 'split by value' on 'vale change' for SRVNR...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
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.