on 12-18-2008 3:49 PM
Hello all
My mapping requirement is
i need to use a if condition to check for the value of a field in source
Source:
<QUOTATION_HEADER_IN>
<ORDCOMB_IN>X</ORDCOMB_IN>
</QUOTATION_HEADER_IN>
<QUOTATION_ITEMS_IN>
<item> 0 to ..unbounded
<REASON_REJ>R1</REASON_REJ>
</item>
<item>
<REASON_REJ>R2</REASON_REJ>
</item>
<item>
<REASON_REJ>R3</REASON_REJ>
</item>
</QUOTATION_ITEMS_IN>
Target Exactly the same. one to one mapping but IF ORDCOMB_IN = X then all the REASON_REJ fileds must have the value R1 ( which is is the first occurance)
I am trying to achieve this. what I have tried is
Mapping:
ORDCOMB_IN -
>
UDF --> SplitByValue --> REASON_REJ(Target Field).
REASON_REJ --> RemoveContext -->
UDF:
Execution Type : Context.
1st param : ORDCOMB_IN
2nd param : REASON_REJ
if(ORDCOMB_IN.length > 0)
{
if(ORDCOMB_IN[0].equals("X"))
{
for(int i = 0;i<REASON_REJ.length;i++)
{
result.addValue(REASON_REJ[0]);
}
}
}
I got this advice from rohit , It worked like charm , But now i need an else block with the If condition . If the the condition that ORDCOMB_IN is notequla to X then REASON_REJ must be mapped as it is to the target strucutre . How can tweak the code to achievbe this ?
When i tried the same with IF with else function , it works only for one instance of ITEM structure , if there are more than one ITEM structure it doesn't work .
Any ideas?
Thanks a lot
HI Sudheer,
try this :
if(ORDCOMB_IN.length > 0)
{
if(ORDCOMB_IN[0].equals("X"))
{
for(int i = 0;i<REASON_REJ.length;i++)
{
result.addValue(REASON_REJ[0]);
}
}
else
for(int i = 0;i<REASON_REJ.length;i++)
{
result.addValue(REASON_REJ<i>);
}
}
It should fix your problem.
Thanks
Pooja Pandey
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.