Powered By

Free XML Skins for Blogger

Powered by Blogger

Wednesday, December 31, 2008

copyValue in XI Message Mappings

Use

You can use CopyValue() to copy the value of a position in the source structure and assign it to a target field for a frequently occurring source structure element. The value is copied each time the target field occurs in the target structure. However, it is copied a maximum of maxOccurs times (also see: Frequently Occurring Elements).

Example

In the example below, the address data is represented in the source structure (street, city, zip code) by the field addrDat, which occurs three times. However, in the target structure, this information is separated into three individual fields (street, city, zipCode):

Source Structure (left) and Target Structure (right)

Field Name

minOccurs

maxOccurs

Field Name

minOccurs

maxOccurs

PartnerMsg

1

1

CustomersMsg

1

1

partner

0

unbounded

customer

0

unbounded

name

1

1

name

1

1

addrDat

3

3

street

1

1




city

1

1




zipCode

1

1

Using the CopyValue() function you can copy the values of field addrDat to the individual target fields. To do so, specify the position that you want to copy. Note that the 0 position refers to the first occurrence of the source field:

Message Mapping Using CopyValue()

Target Field Mapping

Position for CopyValue()

/CustomersMsg=/PartnersMsg


/CustomersMsg=/PartnersMsg


/CustomersMsg/customer/name=
/PartnersMsg/partner/name


/CustomersMsg/customer/street=
CopyValue(/PartnersMsg/partner/addrDat)

0

/CustomersMsg/customer/city=
CopyValue(/PartnersMsg/partner/addrDat)

1

/CustomersMsg/customer/zipCode=
CopyValue(/PartnersMsg/partner/addrDat)

2

No comments: