on 03-01-2014 12:28 AM
Hi ,
I wrote one UDf to check a field out of 3 fields existence and pass the value which is coming. It is working fine for single value.
But when I tired to send multiple values it is suppressing the values.
Any ideas to resolve this: Please see the screesnhsot for refrence:
udf is below: with 3 input variables . If multiple values are coming i do not want to suppress.
String field = null;
if (var1 != null)
{
field = var1;
}
else if (var2 != null)
{
field = var2;
}
else if (var3 != null)
{
field = var3;
}
return field;
Try changing the context of the source field to its parent's parent so, that the values come in a queue without any context ..and then use Advance UDF like it is mentioned and yes... the values are in the form of String so it is advisable to use .equals() to validate string equality
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i tried some thing like this but no luck:
String field = null;
if (var1 != null)
{
field = var1;
}
else if (var2 != null)
{
field = var2;
}
else if (var3 != null)
{
field = var3;
}
for (int i=0; i<field.length;i++);
{
if (!field<i>.equalsIgnoreCase(ResultList.SUPPRESS));
{
result.addValue(field<i>);
}
}
return field;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jan,
from your UDF it is seems you want to pass the field var1 if value is present or check var2 or check var3. If this is the logic then try the below UDF. please input input fields with map with default (Blank)
for (int i=0;i<input.length;i++)
{
if (!var1[i].equals(""))
{
result.addValue(var1[i]);
}
else if (!var2[i].equals(""))
{
result.addValue(var2[i]);
}
else if (!var3[i].equals(""))
{
result.addValue(var3[i]);
}
}
here input can be segment of var1, var2 and var3 or any any of the field in segment which is mand. Please make sure that all the fields including input should be in one context.
refer the wiki - UDF Execution Type - Context and Queue. - Process Integration - SCN Wiki
regards,
Harish
Not only single value...var1 can come multiple times then i need to pass all values out...same case with var 2 var3...do i need to use advanced usf or simple?
i tried ur udf i am getting this error
Function field, Line 1:
cannot find symbol symbol : variable length location: class com.sap.aii.mapping.api.TransformationInput for (int i=0;i<input.length;i++) ^
Function field, Line 3:
array required, but java.lang.String found if (!var1[i].equals("")) ^
Function field, Line 5:
array required, but java.lang.String found result.addValue(var1[i]); ^
Function field, Line 5:
cannot find symbol symbol : variable result location: class com.sap.xi.tf._test_MM_ result.addValue(var1[i]); ^
Function field, Line 7:
array required, but java.lang.String found else if (!var2[i].equals("")) ^
Function field, Line 9:
array required, but java.lang.String found result.addValue(var2[i]); ^
Function field, Line 9:
cannot find symbol symbol : variable result location: class com.sap.xi.tf._test_MM_ result.addValue(var2[i]); ^
Function field, Line 11:
array required, but java.lang.String found else if (!var3[i].equals("")) ^
Function field, Line 13:
array required, but java.lang.String found result.addValue(var3[i]); ^
Function field, Line 13:
cannot find symbol symbol : variable result location: class com.sap.xi.tf._test_MM_ result.addValue(var3[i]); ^
Hi Jan
modify the udf as below and pass all values (var1, var2 and var3) with map with default blank
for (int i=0;i<var1.length;i++)
{
if (!var1[i].equals(""))
{
result.addValue(var1[i]);
}
else if (!var2[i].equals(""))
{
result.addValue(var2[i]);
}
else if (!var3[i].equals(""))
{
result.addValue(var3[i]);
}
}
please let me know if you still phase any issue.
Also i want to know if you have a case where all the values are suppress var1, var2 and var3. Then what you want to do ?
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
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.