cancel
Showing results for 
Search instead for 
Did you mean: 

How to work with MultiMapping

Former Member
0 Kudos

I need to map my message types

source


<PersonInputMessageType>
   <persons>
      <person>
         <name>Test1</name>
      </person>
      <person>
         <name>Test2</name>
      </person>
   </persons>
</PersonInputMessageType>

target


<PersonMessageType>
   <person>
      <name>Test1</name>
   </person>
</PersonMessageType>
<PersonMessageType>
   <person>
      <name>Test2</name>
   </person>
</PersonMessageType>

I created a visual mapping where I mapped fields

pesron->person, name -> name.

The result is


<PersonMessageType>
   <person>
      <name>Test1</name>
   </person>
</PersonMessageType>

What step did I miss?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Sergey,

You could use the removeContexts function in case that there are more than one <persons> tags. I'd suggest the following:

person -> removeContexts -> PersonMessageType,

Constant -> person

name ->name

Best regards

Joachim

Former Member
0 Kudos

I have done it. But test shows only one PesonMessageType. Is it OK or test must show PersonMessageType for each person?

There is 1..1 occurrence for PersonMessageType and I cannot change it.

Former Member
0 Kudos

If your PersonMessageType has 1:1 occurence , you cannot get the desire output. You can get only one PersonMessageType node.

Cheers,

Satish

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Sergey,

You also have to create a mapping

<person> -> <PersonMessageType>

Since in a multi-mapping the occurrence of the result message is set to 0..unbounded, it will not be created automatically (0 occurrences are allowed!!!). By the mapping cited above, you create the same number of target messages, as there are <person> elements.

In addition you also have to take care about the occurrences of the target element <person>. If it's set to 1..1, there is no problem. If it's set to 0..1, please assign a constant to it, to make sure it is built up at runtime.

Best regards

Joachim

Former Member
0 Kudos

I created a maping person->PersonMessageType,

person->person, name->name

Between what elements do I have to add removeContext function?

I have tried person->removeContext()->person. But It doesn't work.

Target person element has 1 occurrence and source 1..unbounded

Former Member
0 Kudos

Use Remove context between

person->(RemoveContext )->PersonMessageType

since you want to create Personmessage type node as many time as person you have to manage context of Person at root level.

Regards,

satish

Former Member
0 Kudos

Hi Sergey,

YOu need to use the removeContexts() function.

Regards

Priyanka