Affinity Sequencing

Affinity Sequencing is used to support the scenario for maintaining sequencing during affinity grouping. Affinity Sequencing was introduced during affinity RulesEngine (BusinessEvents) selects plan items at random which are then merged into a single plan item. Since items are selected at random during this process, sequencing is not maintained for plan items that must be in a sequence.

To make products available for affinity sequencing:

  • Affinity TYPE value for all products where sequence should be respected should be set to "SequencedAffinity" in the affinity type
  • All order lines where affinity components are known to exist should have a UDF defined as AffinitySequence and the value should be an integer

Depending on the AffinitySequence values being compared, the following actions are possible:

  1. itemA.AffinitySequence = itemB.AffinitySequnce
    • If both items have dependent children the children from itemB will be copied to itemA
    • itemB parent will be updated with the plan item ID from itemA, thus making itemA dependent to its own parent and the itemB parent
    • UDF values from itemB will be merged into itemA
    • Any item which has a reference to itemB will have that reference replaced with a reference to itemA
    • The instance of itemB will be deleted from the plan
    Parallel Scenario

    Parallel Scenario

    The figure depicts the scenario where the items to be affinity grouped are running in parallel. One of the items in this case itemB will be deleted from the plan. The dependent items to itemB which are childB1 and childB2 are made dependent to itemA. Then itemA is made dependent to parentB which is the parent to itemB.

  2. itemA.AffinitySequence < itemB.AffinitySequnce
    • itemB will be merged into itemA
    • UDF values from itemB will be merged into itemA
    • Any item which has a dependency to itemB will have that reference removed
    • all the children from itemB will be made dependant to itemB parent(s)
    • itemB will be deleted from the plan
    Sequenced Scenario

    Sequenced Scenario

    The figure depicts an offering which has items that are in parallel as well as in sequence that need to be affinity grouped. For items that are in parallel they are handled similar to the figure 1. For the item that is in sequence itemC. It is dependent item offerB is made dependent to CommercialA which is the parent to itemC.

  3. itemA.AffinitySequence > itemB.AffinitySequnce

    • itemA will be merged into itemB
    • UDF's from itemA will merged into itemB
    • if itemA has dependent children those children will be copied into itemB and the parent item of itemA
    • Any item which has a reference to itemA will have that reference erased
    • itemA will be deleted from the plan
    Items in Sequence

    Items In Sequence

For all the above actions the following occurs in all of them:

  • EOL, Plan description and Line ID values will all be merged into comma separated values from itemA and itemB
  • The planID will be updated with the affinity plan ID
Note: When an order is submitted, the order lines for items which have Affinity should have the AffinitySequnce defined and updated.
Note: To not merge certain udfs during Affinity Sequencing, those udfs should be added as a comma separated values in the global variable CharacteristicsWithoutAffinityPostfix in the rules engine (AOPD).