Conditional Affinity Sample

The conditional affinity sample is as follows:

A product model has two parents:

  • Parent_A
  • Parent _B

Consider a product model where conditional affinity is defined at all the child products:

  • Child_A1
  • Child_B1
  • Child_B2
Conditional Affinity

The XPATH defined in the product model is evaluated against the submitted order schema.

The following table describes the attribute-based conditional affinity scenarios:

Attribute Sample XPATH Expressions Order Payload
AffinityCondition exists($var/Order/OrderHeaderUDF[name=UDFNAME and value="UDFVALUE"])
<ord1:udf>
<ord1:name>UDFNAME</ord1:name>
<ord1:value>UDFVALUE</ord1:value>
</ord1:udf>
AffintyCorrelation $var/Order/orderlines[productID='Child_A1']/

OrderlinesUDF[name='UDFNAME']/value/text()

<ord1:line>
  <ord1:lineNumber>1</ord1:lineNumber>
  <ord1:productID>Child_A1</ord1:productID>
  <ord1:quantity>1</ord1:quantity>
  <ord1:uom>1</ord1:uom>
  <ord1:action>PROVIDE</ord1:action>
  <ord1:actionMode>New</ord1:actionMode>
  <ord1:udf>
   <ord1:name>UDFNAME</ord1:name>
   <ord1:value>UDFVALUE</ord1:value>
  </ord1:udf>
</ord1:line>

AffintyParentGroup Child_B1 and Child_B2 have immediate parent. The two will be affinity grouped when: AffintyParentGroup=true
AffinityActionValue
Note: The affinityAction Group must be true
$var/Order/orderlines[productID='Child_A1']/

OrderlinesUDF[name='UDFNAME']/value/text()

<ord1:line>
 <ord1:lineNumber>1</ord1:lineNumber>
 <ord1:productID>Child_A1</ord1:productID>
 <ord1:quantity>1</ord1:quantity>
 <ord1:uom>1</ord1:uom>
 <ord1:action>PROVIDE</ord1:action>
 <ord1:actionMode>New</ord1:actionMode>
 <ord1:udf>
 <ord1:name>UDFNAME</ord1:name>
  <ord1:value>UDFVALUE</ord1:value>
  </ord1:udf>
</ord1:line>