core:itemMatcher (Identifying a list entry by rule)
Prev Next Structure
XML
Description
Input XML
<?xml version="1.0" encoding="UTF-8"?>
<shp:Shipment xmlns:shp="SCM.SHIPMENT" creatorId="1"
ownerId="1" lastModifierId="1">
<lineItems>
<lineItem lineItemId="1" parentLineItemId="">
<attributes>
<shp:ShipmentLineItemReference>
<value referenceType="ORDER_NUMBER" reference="4711"/>
</shp:ShipmentLineItemReference>
<shp:ShipmentLineItemText>
<value textType="COMMENT">
<textValue>TMS</textValue>
</value>
</shp:ShipmentLineItemText>
</attributes>
</lineItem>
<lineItem lineItemId="2" parentLineItemId="">
<attributes>
<shp:ShipmentLineItemReference>
<value referenceType="ORDER_NUMBER" reference="4712"/>
</shp:ShipmentLineItemReference>
<shp:ShipmentLineItemText>
<value textType="COMMENT">
<textValue>Lobster_pro</textValue>
</value>
</shp:ShipmentLineItemText>
</attributes>
</lineItem>
<lineItem lineItemId="3" parentLineItemId="">
<attributes>
<shp:ShipmentLineItemReference>
<value referenceType="ORDER_NUMBER" reference="4713"/>
</shp:ShipmentLineItemReference>
<shp:ShipmentLineItemText>
<value textType="COMMENT">
<textValue>ERP</textValue>
</value>
</shp:ShipmentLineItemText>
</attributes>
</lineItem>
</lineItems>
</shp:Shipment>The data of a ‘Shipment’ entity (see Shipments ) with 3 line items and 2 attributes each (reference attribute ORDER_NUMBER and text attribute COMMENT) should be updated.
Objective:
An Import should update the comment (COMMENT) for an line item identified by its order number (ORDER_NUMBER).
Import XML
[...]
<shp:Shipment [...]
<lineItems>
<lineItem>
<core:itemMatcher>
<core:EntityPropertyRule>
<core:EqualsMatcher deepCompare="false">
<core:LiteralValueResolver>
<value xsi:type="xsd:string">4712</value>
</core:LiteralValueResolver>
</core:EqualsMatcher>
<core:ChainedResolver>
<core:TypedAttributeResolver typedAttribute="base:ReferenceAttribute"
type="base:ReferenceType#ORDER_NUMBER" />
<core:PropertyResolver property="reference" />
</core:ChainedResolver>
</core:EntityPropertyRule>
</core:itemMatcher>
<attributes>
<shp:ShipmentLineItemText>
<value textType="COMMENT">
<textValue>Lobster Data Platform / Orchestration</textValue>
</value>
</shp:ShipmentLineItemText>
</attributes>
</lineItem>
</lineItems>
</shp:Shipment>
[...]
The text value of the text attribute COMMENT of the line item with the text ‘4712’ for the reference property of its reference attribute ORDER_NUMBER should be updated to the text ‘Lobster Data Platform / Orchestration’.
The structure to the left shows an excerpt of the target structure of an Import . The core:itemMatcher node within its lineItem node defines, how the line item to update should be identified. This example defines an Entity property rule , which specifies a match of the reference property of the reference attribute ORDER_NUMBER with a static text (‘4712’).
The following attributes node defines the data to apply to a matching line item as an update.
Output XML
<?xml version="1.0" encoding="UTF-8"?>
<shp:Shipment xmlns:shp="SCM.SHIPMENT" creatorId="1"
ownerId="1" lastModifierId="1">
<lineItems>
<lineItem lineItemId="1" parentLineItemId="">
<attributes>
<shp:ShipmentLineItemReference>
<value referenceType="ORDER_NUMBER" reference="4711"/>
</shp:ShipmentLineItemReference>
<shp:ShipmentLineItemText>
<value textType="COMMENT">
<textValue>TMS</textValue>
</value>
</shp:ShipmentLineItemText>
</attributes>
</lineItem>
<lineItem lineItemId="2" parentLineItemId="">
<attributes>
<shp:ShipmentLineItemReference>
<value referenceType="ORDER_NUMBER" reference="4712"/>
</shp:ShipmentLineItemReference>
<shp:ShipmentLineItemText>
<value textType="COMMENT">
<textValue>Lobster Data Platform</textValue>
</value>
</shp:ShipmentLineItemText>
</attributes>
</lineItem>
<lineItem lineItemId="3" parentLineItemId="">
<attributes>
<shp:ShipmentLineItemReference>
<value referenceType="ORDER_NUMBER" reference="4713"/>
</shp:ShipmentLineItemReference>
<shp:ShipmentLineItemText>
<value textType="COMMENT">
<textValue>ERP</textValue>
</value>
</shp:ShipmentLineItemText>
</attributes>
</lineItem>
</lineItems>
</shp:Shipment>Result: The second line item (with ORDER_NUMBER ‘4712’) was updated.
Was this article helpful?
Yes No