Conditional Affinity

Conditional Affinity combines InLink and CrossLink affinities in a single affinity type and provides additional flexibility. Affinity grouping enables different plan items to be grouped together based on the evaluation of the XPATH expression defined at the product catalog. The two affinity grouping types are:

Inlik Affinity Crosslink Affinity
Affinity groups plan items having the same parent product share a common LinkID UDF value and have the same affinity plan fragment name Affinity groups plan items having the same affinity plan fragment name

The additional configuration fields and rules in conditional affinity are:

Field Description
AffinityType Determines the type of affinity implemented.
  • InLink
  • CrossLink
  • Sequenced Affinity
  • ConditionalAffinity
AffinityCondition Valid for Conditional type only. A String field containing an XPATH expression that evaluates to true or false based on data is in the order:
  • If the expression is true, the product plan item is affinity-grouped
  • If the expression is false, then the product plan item is not affinity-grouped
  • If the field is blank, assume that the value is true
  • If the XPATH expression evaluates to anything other than the true or false, AOPD fails, and returns an exception
The XPATH expression evaluates against the following data fields on the order:
  • Order Header UDF Name and Value
  • Order Line ProductID
  • Order Line Action and ActionMode
  • Order Line UDF Name and Value

The XPATH expression can also be defined against the following plan data fields:

  • planItem productID
  • planItem UDF name value
  • planItem Action
AffinityCorrelation Valid for Conditional type only. The XPATH is evaluated on the Plan data and the order data. A String field containing an xpath expression based on a data is in the following order:
  • All plan items that evaluate to the same AffinityCorrelation are grouped together
  • The field is functionally similar to the LinkID method of correlating plan items in the InLink affinity. However, it allows correlation based on complex conditions without a restriction on the UDF names
  • If the field is blank, a default LinkID value is shared by all other blank configurations
  • If the XPATH expression evaluates to an empty string, the XPATH expression is blank, or assume a default LinkID
The XPATH expression evaluates against the following order data fields:
  • Order Header UDF Name and Value
  • Order Line ProductID
  • Order Line Action and ActionMode
  • Order Line UDF Name and Value

The XPATH expression can also be defined against the following plan data fields:

  • planItem productID
  • planItem UDF name value
  • planItem Action
AffinityParentGroup Valid for Conditional type only. A boolean field containing the value true or false:
  • If set to true, the plan items with products sharing the same immediate parent product are grouped together
  • If set to false, the parent product is not considered for grouping
AffinityActionGroup Valid for Conditional type only. A boolean field containing the value true or false:
  • If set to true, then only plan items with products that share the same action are grouped together
  • If set to false, then action is not considered for grouping
AffinityActionValue AffinityActionValue is considered for grouping when AffinityActionGroup is set to true. This is valid for Conditional type only. String field containing an XPATH expression that evaluates to a String based on data is in the following order: The XPATH expression must evaluate to one of the following:
  • PROVIDE
  • UPDATE
  • CEASE
  • Empty String
If the XPATH expression evaluates to anything other than these actions, then AOPD fails and returns an exception.
  • If the field is blank, or the return value from the XPATH expression is an empty string, the remaining action rules must be applied.
The XPATH expression is able to evaluate against the following data fields on the order:
  • Order Header UDF Name and Value
  • Order Line Action and ActionMode
  • Order Line UDF Name and Value

The XPATH expression can also be defined against the following plan data fields:

  • planItem productID
  • planItem UDF name value
  • planItem Action
AffinityProvide Provide plan fragment name for affinity grouped plan item. Only plan items with the Provide action and the same value in this field are grouped together
AffinityUpdate Update plan fragment name for affinity grouped plan item. Only plan items with the Update action and the same value in this field are grouped together
AffinityCease Cease plan fragment name for affinity grouped plan item. Only plan items with the Cease action and the same value in this field are grouped together
AffinityCancel Cancel plan fragment name for affinity grouped plan item. Only plan items with the Cancel action and the same value in this field are grouped together

In the case where plan items with different actions are grouped together due to affinity, the following logic is used to determine what action to apply to the plan item. The following rules apply:

  1. If AffinityActionValue is specified, then the action of the plan item will be the result of evaluating this xpath.
  2. If AffinityActionValue is blank, or evaluates to an Empty String, then the remaining rules will apply:
    1. If all order lines have the same action, then the plan item action is the same as the order lines.
    2. If order lines have different actions, then:
      1. If at least one order line has PROVIDE action, then the plan item will have PROVIDE action.
      2. Otherwise if at least one order line has CEASE action, then the plan item will have CEASE action.
      3. Otherwise, the plan item will have UPDATE action.

For details, see Fulfillment Catalog Product Catalog Guide.

Important: 1) If XPath is defined against plan data, the format should be <Actual XPath> containing string $var/PlanItem. For example, if you want to define the XPath for UDF name-value pair MSISDN=123, the XPath can be $var/PlanItem[productID='GSMLine']/udfs[name='MSISDN']/value/text().

XPath evaluates data from the planItem. Refer to the sample planItem xml.

2) If XPath is defined against the order data, the format should be <Actual XPath> containing string $var/Order. Refer to Sample order XML

3) Default order data is considered for evaluation if XPATH does not contain $var/PlanItem.

Note: Refer to Sample XPATHs for XPATH definitions.

When AOPD returns a plan it indicates the action of the plan item. Under normal circumstances this maps directly to the action of the associated order line that caused the creation of the plan item. In the case where plan items with different actions are grouped together, the following logic is applicable to determine what action to apply to the plan item.

  1. If AffinityActionValue is specified, then the action of the plan item will be the result of evaluating this xpath.
    • If AffinityActionValue is blank, or evaluates to an Empty String, then the remaining rules will apply
  2. If all order lines have the same action, then the plan item action is the same as the order lines.
  3. If order lines have different actions, then:
    • If at least one order line has PROVIDE action, then the plan item will have PROVIDE action.
    • Otherwise if at least one order line has CEASE action, then the plan item will have CEASE action.
    • Otherwise the plan item will have UPDATE action.