cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue

former_member331856
Participant
0 Kudos

Hi Experts,

My source Payload is below:

<EmpID_Source>

<Item>

<EmpID>11314 123456 1678901 14789123</EmpID>

</Item>

</EmpID_Source>

I need the Target Payload as below:

<EmpID_Target>

<Item>

<EmpID>11314</EmpID>

<EmpID>123456</EmpID>

<EmpID>1678901</EmpID>

<EmpID>14789123</EmpID>

</Item>

</EmpID_Target>

EmpdId Filed in the Source Payload has the 4 Numbers Seperated by Space.

<EmpID>11314 123456 1678901 14789123</EmpID>

EmpdId Filed on Target should be dynamically created based on the SOurce Emp Field.

Please gudie me how can i achieve the udf for this.

Thank you,

Regards,

GIRIDHAR

Accepted Solutions (1)

Accepted Solutions (1)

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Giridhar,

PFB the udf code for the requirement. This is written assuming if there are multiple records coming in the input:

Please check this and let me know if you face any issues.

Regards

Vishnu

Answers (1)

Answers (1)

RaghuVamseedhar
Active Contributor
0 Kudos

Giridhar,

Write a UDF (values of context) with below for loop.


public void udf_split(String[] EmpID, ResultList EmpID_out, Container container) throws StreamTransformationException {

 

    for (String empID : EmpID[0].split(" ")) {

        EmpID_out.addValue(empID);

    }

   

}