on 12-20-2007 8:10 AM
Hi,
My input is in this format. NODE is 0...unbounded
<Taxes>
<Tax TaxCode="US2" Amount="30.20" CurrencyCode="USD" DecimalPlaces="2" />
<Tax TaxCode="XY" Amount="7.00" CurrencyCode="USD" DecimalPlaces="2" />
<Tax TaxCode="XA" Amount="5.00" CurrencyCode="USD" DecimalPlaces="2" />
<Tax TaxCode="AY" Amount="5.00" CurrencyCode="USD" DecimalPlaces="2" />
<Tax TaxCode="XD" Amount="24.44" CurrencyCode="USD" DecimalPlaces="2" />
<Tax TaxCode="UK" Amount="21.83" CurrencyCode="USD" DecimalPlaces="2" />
<Tax TaxCode="XF" Amount="9.00" CurrencyCode="USD" DecimalPlaces="2" />
</Taxes>
My Target should be in this format.
Tax code = US2,XY,XA,,AY,XD,UK,XF
I need to write an UDF for this.
Thanks
Vikranth Khimavath
Hi Khimavath,
Pass the context in the UDF with one input of Tax code and inside UDF write following code:
String s = a[0];
for(int i=1;i<a.length;i++)
{
s= s + "," + a<i>;
}
result.addValue(s);
This will meet your requirement.
Regards,
Amit.
Edited by: Amit Valecha on Dec 20, 2007 2:26 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey khimavath,
Just copy paste the following code:
java.lang.String str =a[0];
for(int i=0;i<a.length;i++)
str = str + "," + a<i>;
result.addValue(str);
Just make a little change in above code that inside for loop write a with index i in square braces I am not able to do dat coz its used for highlighting links while posting.
I have tried it myself,It would solve your problem.
Cheers,
Amit.
Edited by: Amit Valecha on Dec 20, 2007 3:26 PM
>java.lang.String s = a[0];
>for(int i =1; i<a.length; i++)
>{
>s = s + a<i>;
>}
>result.addValue(s);
This shud do your job.THe statement inside the for loop is
s = s plus a(i)( use square brackets)
Thanks and regards
Hari
Reward if useful.
Edited by: Sreehari Nambiar on Dec 20, 2007 11:13 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use multiple concat in graphical mapping to map the output to Tax code.
use concat and drag the first input US2 to the first location and give "," for the other input and then same thing once again. in other input put the output of first concat and then "," in other and finally map it to Tax Code.
Like this XA,,AY,XD,UK,XF
Concat input 1 Input 2 Result
US2 , US2,
US2, XY US2,XY
US2,XY , US2,XY,
........................................
similarlty till last one and output to TAx code the target valur.
Hope this will help you.
Regards
Aashish Sinha
PS : reward points if helpful
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.