on 07-11-2014 4:23 PM
Hi Experts,
My requirement is : I will get three variables from source. All contexts are different.
I need UDF for first variable(Var1) should compare with array of second variable(Var2 array of values) and pass the third variable if first variable is equal to any of the variable in Var2 array.
Appreciate your help on this.
Example:
Var1:
4
5
4
6
5
4
4
Var2:
1
2
3
4
5
Var3:
1001
1002
1003
1004
1005
1006
1007
Result:
1001
1002
1003
1005
1006
1007
Note: 1004 is not there in result because in var1 6 is not matched with array of var2 values.
Thnaks & regards,
A.Neelima.
Hi Neelima
Use the below code.
for(int i=0;i<var1.length;i++){
for(int j=0;j<var2.length;j++){
if(var2[j] == var1[i])
resultset.add(var3[i]);
}
}
if var1, var2 are string then replace the if condition with the following
if(var2[j].equals(var1[i]))
Note: length of Var1 and Var3 should be always equal.
Regards
Osman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please close the thread If your issue resolved.
http://scn.sap.com/community/support/blog/2013/04/03/how-to-close-a-discussion-and-why
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
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.