cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue

Former Member
0 Kudos

Hello Experts

I am stuck with a mapping issue.

Source Payload Structure:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:response xmlns:ns0="http://test/1.0">abc,123,def</ns0:response>

Expected Target Payload Structure:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Record xmlns:ns0="http://test/1.0"><response><Field>abc</Field><Field>123</Field><Field>def</Field></response></ns0:Record>

Please help share any sample UDF that could be used for this.

Thanks

Jaya

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jaya,

Here you go:

Input to this UDF wil be response field from source, which contains the comma separated values and output of UDF will be mapped to Field in target structure:

UDF with context option:

sourceVal  - which contains the input string

String[] strArray = sourceVal[0].split(“,”);

for (String str : strArray) {

result.addValue(str);

result.addContextChange();

}

Former Member
0 Kudos

Thanks Divyesh. That was really quick and it worked.

Former Member
0 Kudos

Nice to know

Divyesh

Answers (0)