cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for calculations on 9 fields

Pranil1
Participant
0 Kudos

Hello Everyone,

I want to implement an UDF in PI mapping which is having 8 values as input and 2 values as output.

I need to carry out the calculations on these 8 values using the matrix provided

and need to map the two output values to two target fields of an IDOC.

I am not an expert in JAVA coding. Can you pls help me out with a better approach for an UDF and if possible provide me the sample code for the same.

Regards,

Pranil.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

which version of PI u r working on??

If (>) PI 7.1 then u can create a udf with two resultlist...

and then map the output of UDF to 2 target Idoc fields.

Pranil1
Participant
0 Kudos

Hi Amit,

Thanks for your input. I am using PI7.1. Can you pls provide me the sample code for the UDF.

Regards,

Pranil.

Former Member
0 Kudos

u can search SDN for sample code. In ur case u have to define a UDF with below parameters:

Chosse execution type: all values of a context

under signature variables define 8 input variables of type "Argument" and 2 variables of type "Result"

BTW whats ur UDF logic..u can paste here so that someone can help u

let me give u a simple example:

suppose i have to create a UDF for splitting a string "123-456" and map the output to 2 target fields.

my UDF will be :

execution type: all values of a context

Input will be : var1 as argumnet type

result1 as Result type

result2 as Result type


String delimiter ="-" ;
String[] temp = var1[0].split(delimiter);
result1.addValue(temp[0]);
result2.addValue(temp[1]);

mapping:


                       / TargetField1
Input  -----UDF-----
                      \ TargetField2

Answers (3)

Answers (3)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

PI mapping which is having 8 values as input and 2 values as output.

I need to carry out the calculations on these 8 values using the matrix provided

and need to map the two output values to two target fields of an IDOC.

If you can give more information about these inputs, maybe we can help you more.

Regards,

Mark

Former Member
0 Kudos

need to map the two output values to two target fields of an IDOC.

you have to write 2 UDF's for 2 Target fields .

rajasekhar_reddy14
Active Contributor
0 Kudos

write 2 user defined function for 2 target fields.

Pranil1
Participant
0 Kudos

Hi Raja,

Thanks for your reply. But the values of 2 output values depend upon the calculations and availability of the 9 input values.

So I need to club the 2 output values in single UDF.

Any idea on how to implement this?

Regards,

Pranil.