on 05-07-2012 7:40 AM
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 🙂
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nithin,
UDF development is required.
Regards,
NagaVenkataSatyanarayana.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.