on 09-19-2008 8:55 PM
Hi,
My source XML looks like this
<GLDEBITACCT>
<VALUE>0545-K-2006605-5500001</VALUE>
<GLCOMP glorder="0">0545</GLCOMP>
<GLCOMP glorder="1">K</GLCOMP>
<GLCOMP glorder="2">2006605</GLCOMP>
<GLCOMP glorder="3">5500001</GLCOMP>
</GLDEBITACCT>
Where glorder is the attribute of GLCOMP. Now I have requirement to read the attribute ( atleast 2 of them)
I have to map to target field checking the value in glorder="1
For e.g. with above XML, if the value in glorder="1 is K than map value from glorder="2 (2006605) to Target 1.
IF the glorder="1 is P map the value in glorder="2 to Target 2 and goes on for another one
How can i acheive this mapping. When I tried putting the value of glorder, i am not getting anything.
Regards,
Hi,
You can use below UDF. Please make sure to select context parameter while creating UDF. There will be 3 input arguments for this function:
1. GLCOMP (a)
2 @glorder (b)
3 Constant (c) --depending upon the target node
Also conext of attribute @glorder should be same as that of GLCOMP.
//write your code here
for(int i=0;i<a.length;i++)
{
if(b<i>.equals("1")&&c[0].equals(a<i>))
{
for(int j=0;j<a.length;j++)
{
if(b[j].equals("2"))
{
result.addValue(a[j].toString());
break;
}
}
}
}
For target node target1 use K as 3rd argument, for target node target2 use P and so on.
Let me know how it works.
Regards,
Anirudh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Thanks for the reply. I am getting syntax error for braces. Also as you can see, GLCOMP has multiple values
<GLCOMP glorder="0">0545</GLCOMP>
<GLCOMP glorder="1">P</GLCOMP>
<GLCOMP glorder="2">1234</GLCOMP>
<GLCOMP glorder="3">4200003</GLCOMP>
Would GLCOMP be array..?
Any suggestions are welcome.
Regards,
Hi,
How many such conditions do you have?
Regards,
Anirudh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.