cancel
Showing results for 
Search instead for 
Did you mean: 

1:n mapping

jiri_medved
Participant
0 Kudos

Hello experts,

as an inbound message I have a XML like following

<record>

<id>1</id>

<phone1>1234</phone1>

<phone2>1235</phone2>

<phone3>1236</phone3>

<mobile>1237</mobile>

<fax>3215</fax>

</record>

<record>

<id>2</id>

<phone1>5646</phone1>

<phone2>6544</phone2>

<phone3>8788</phone3>

<mobile>8785</mobile>

<fax>5454</fax>

</record>

<record>

<id>3</id>

<phone1>5455</phone1>

<phone2>2115</phone2>

<phone3>5454</phone3>

<mobile>3213</mobile>

<fax>2122</fax>

</record>

I need to map if to the outbound interface as following:

<record>

<id>1</id>

<type>phone1</type>

<number>1234</number>

</record>

<record>

<id>1</id>

<type>phone2</type>

<number>1235</number>

</record>

<record>

<id>1</id>

<type>phone3</type>

<number>1236</number>

</record>

...

<record>

<id>3</id>

<type>fax</type>

<number>2122</number>

</record>

The order of the outbound records is not important. How can this be done? Preferably in the graphical interface without programming.

Regards

Jiri

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jiri

You can create a 1...unbounded RECORD field on target data type, with ID, TYPE and NUMBER as subfields.

In the graphical mapping, right click on the RECORD targe field and choose "Duplicate subtree".

A new RECORD will be added with all its subfields. Repeat this until you have a target RECORD for each source field like phone1, phone2....

Map target RECORD field with PHONE1, the second record with PHONE2, and so on.

You can just map them all with source RECORD field if all PHONE1, PHONE2... fields are mandatory.

Then you need to map the target ID with source ID.

For the TYPE target field, use a constant "PHONE1" and then map the PHONE1 field with target NUMBER field.

Iterate this replacing the constant "PHONE1" with the needed value and mapping target NUMBER field with correct source field.

Regards,

Giuseppe

Answers (2)

Answers (2)

jiri_medved
Participant
0 Kudos

Thank you both. Simple and functioning!

Regards

Jiri

Former Member
0 Kudos

Hi,

This can be done very easily in GUI mapping. In your target structure, use duplicate subtree on record twice, for the 3 <phone fields>.

<Type> will be hardcoded to phone1/phone2/phone3.

For the Id and number fields, use the context handling to map them to the target.

Also, this would be a simple 1:1 mapping, no multimapping required here.

Regards