Skip to Content
avatar image
Former Member

How to work with MultiMapping

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 14, 2005 at 08:48 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

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

      Cheers,

      Satish

  • avatar image
    Former Member
    Oct 14, 2005 at 07:51 AM

    Hi Sergey,

    YOu need to use the removeContexts() function.

    Regards

    Priyanka

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 14, 2005 at 08:22 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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