on 12-16-2008 3:35 PM
Hello experts I have a requirement where my source and target fileds are almost same.
source:
<A>
<B>
<C>
<E>
<F> 0...unbounded
<G>
<H>
Target:
<I>
<J>
<K>
<M>
<N> 0...unbounded
<O>
<P>
My requirement is if B = X then O = first occurance of G. and its the same for all N unbounded occurances.
I tried using an if condition and copy of value(0) for my putput , but for exmaple say i have three occurences of N I see my desired output only in the first occurance , the other two occurances don't have the O filed.
Any Mapping tips
Thanks
Hi Sudheer,
Your requirement is not clear. Can you try to explain it using some example ?
Thanks,
Pooja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi I will try explain my problem again
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>
<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 hte value R1 ( whihc is the first value)
I am trying to achieve this what I have tried is
if ORDCOMB_IN (TextEquals) X then REASON_REJ ( copyvalue (0) ) to REASON_REJ( target side) .
But the problem i face is out of the three calues of REASON_REJ in the Item node only one is being populated. I can't see the remaining two.
This works when i chnage the if condition to say some constantX eualsto constantX , but doesn't work when i use the field ORDCOMB_IN. I tried using ORDCOMB_IN with all contexts , and removed context and coallapsed but none works .
Any ideas?
Thanks a lot
Hi sudheer
To the most i understand that you are checking for a field as X and if true then you want then you are copying a value.
It works fine for me without changing context
ORDCOMB_IN ->(EqualS(X)) -> ifWithoutElse (REASON_REJ in then)-> REASON_REJ
Another way
public String checkArgument(String ORDCOMB_IN,String REASON_REJ,Container container){
if (ORDCOMB_IN.equalsIgnoreCase("X"));
return REASON_REJ;
}
Thanks
Gaurav
Hi,
You can try following mapping with UDF.
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]);
}
}
}
-Rohit.
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just need a little tweak for my requirement .
What rohit suggested with UDF works fine with the IF condition , I need to make an else as well , i want to assign REASON_REJ as it is if the condition is not met.
Any ideas
Thank you .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can try with node functions like removeContext or spitByValue. or provide more detail on requirement.
thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't get exactly what you're trying to do, but I guess you should work with different contexts there. Right-click the attribute in your graphical mapping and follow the contexts option. Try a little bit, maybe you'll get the solution quickly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
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.