on 05-09-2007 1:23 PM
I have a UDF which is the following:
for(int i = 0 ; i < a.length ; i++)
{
for(int j = 0 ; j < b.length ; j++)
{
if(a<i>.equals(b[j]))
{
result.addValue(c[j]);
}
}
}
Now I have 3 inputs and 1 output as you can see. So my scenario is this.
In0 In1 In2 Out0
111 111 AAA AAA
222 333 CCC CCC
333
This is causing problems in my Mapping... I need the result to reflect th In0 Queue so My Out0 should look like this
AAA
Empty
CCC
Can you guys see what I am trying to achieve... I basicaly want my output values to occur in the same position in the queue that the in0 value occured and anything in between that doesnt have a match should appear as an empty string...
Please let me know how to do this or edit my UDF accordingly?
Hi,
If a,b,c inputs are the same length , then you can achieve this , i mean if the a,b are equal no of inputs , then , if the c also contains the equal no of values then you can get the c(index) respective index value will be assigned to the result, other wise ww would have to check and add the empty value / constant value to be assigned to the result.
Regards
Chilla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you want to have the values of In0 in the same order they appeared, you have to set the empty string in case nothing was found in the outer loop where you go over In0.
String res = null;
for(int i = 0 ; i < a.length ; i++)
{
res = "Empty";
for(int j = 0 ; j < b.length ; j++)
{
if(a.equals(b[j]))
{
res = a[j];
break;
}
}
result.addValue(res);
}
in this case the string res will be Empty unless a match is encountered and the string is altered. then after comparing each item in a with all items in b, the String is added to the result, so either it has a value or "Empty".
Regards
Christine
Hey
try using the bewlo code
for(int i = 0 ; i < a.length ; i++)
{
for(int j = 0 ; j < b.length ; j++)
{
if(a.equals(b[j]))
{
result.addValue(c[j]);
}
else
{
result.addValue("Empty");
}
}
}
Thanx
Ahmad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
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.