cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

RaghuVamseedhar
Active Contributor
0 Kudos

Saurabh,

Please use SplitByValue before partner Number (it seems all values are going into first IDoc).

Please post screenshot of mapping, it will be helpful to guide you.

Former Member
0 Kudos

I am using split by value. but its not coming into other idocs other than first IDOC   

for your ref. IdentiferV is "value" in my question.

RaghuVamseedhar
Active Contributor
0 Kudos

Saurabh,

Can you post display queue screenshot of 'code', 'IdentiferV' and parent node of 'PARTNER'.

former_member184720
Active Contributor
0 Kudos

Change the context for IdentiferV field and set it to same as code.


And you should add the same mapping for IDOC/Target node without splitbyvalue.

However you should add remove context instead of splitby value (only for IDOC/target node) after the ifwithoutelse function.


Former Member
0 Kudos

The actual value is "10016" not "1", so posting queues accordingly.

RaghuVamseedhar
Active Contributor
0 Kudos

Saurabh,

To above mapping, add removeContext after 'code' and 'IdentiferV'.

Answers (0)