on 05-27-2011 9:17 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you both. Simple and functioning!
Regards
Jiri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.