cancel
Showing results for 
Search instead for 
Did you mean: 

Help in GUI mapping for simple scenario

Former Member
0 Kudos

Hi i am new to SAP PI, can you please help me with the mapping for the following scenario:

Source data type:

<Employees>

<Employee>

<EmpName> E1</EmpName>

<EmpSal>1</EmpSal>

</Employee>

<Employee>

<EmpName> E2</EmpName>

<EmpSal>2</EmpSal>

</Employee>

<Employee>

<EmpName>E3</EmpName>

<EmpSal>3</EmpSal>

</Employee>

</Employees>

Target data type :

<Total_Employees>

<Names>E1 E2 E3</Name>

<Pay>6</Pay>

</Total_Employees>

can you please tell me what is to be done to attain this in GUI Mapping

Thanks in advance 🙂

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Nithin,

To concatenate the names you can do an UDF function:

You could put like category type all values on context or all values on queue, it depens how the values come to the UDF, and later:

imports java.lang.*;

public void nConcatenate(String input[], ResultList result, container Container){

String stringConcatenated = "";

   

for (int i = 0; i < input.length; i++){
stringConcatenated += input[i] + " ";
}
result.addValue(stringConcatenated);

You could do a similar function in order to obtain a the Pay tag, but with the sum operation.

Regards.

Message was edited by: Iñaki Vila

Former Member
0 Kudos

Thank you for that but is it possible with predefined functions ?

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

U can also use standard function SUM (under statistic) to achieve the desired output for target filed "Pay"

EmpSal (change its context yto employees) --> SUM---> Pay

However, go with UDF (as suggeted above) for "Names" field mapping

Thanks

Amit Srivastava

0 Kudos

Hi Nithin,

UDF development is required.

Regards,

NagaVenkataSatyanarayana.