Skip to Content
0
Former Member
Jun 25, 2015 at 06:27 PM

how to populate a field with different values depending on count of occurrence of message?

34 Views

Hi Experts,

I have a requirement. I have a source structure like this:

<root>

<identifiers>

<identifier1>

<Code>......

<Value>......

</identifier1>

<identifier2>

<Code>......

<Value>......

</identifier2>

<identifier3>

<Code>......

<Value>......

</identifier3>

</identifiers>

<root>

Now I target structure like this.(it is idoc)

<Target>

<Partner Number>

</Target>

Now my mapping should be able to do following things

i) if in source side the value of "Code" is "1" create a target message else no. so I have to create as many idocs as many time I get "Code" equal to "1".

ii) now whenever I am creating an idoc the field "Partner Number" on target side should be equal to corresponding source field "Value"

so if My source XML is like this:

<root>

<identifiers>

<identifier1>

<Code>1<Code>

<Value>234<Value>

</identifier1>

<identifier2>

<Code>2<Code>

<Value>456<Value>

</identifier2>

<identifier3>

<Code>1<Code>

<Value>666<Value>

</identifier3>

</identifiers>

<root>

I should generate two idocs as below;

IDOC 1:

<target>

<partner Number> 234 </partner Number>

</target>

IDOC 2:

<target>

<partner Number> 666 </partner Number>

</target>

It seems simple but somehow I am not able to do this? its creating two idocs where in second one partner field is not coming and in first one it is coming fine.

Can you please help with this?

Warm Regards

Saurabh