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 must be respected must be set to "SequencedAffinity" in the affinity type
  • All order lines where affinity components are known to exist must have a user-defined field defined as AffinitySequence and the value must 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 is copied to itemA
    • itemB parent is updated with the plan item ID from itemA, thus making itemA dependent to its own parent and the itemB parent
    • user-defined field values from itemB is merged into itemA
    • Any item, which has a reference to itemB have that reference replaced with a reference to itemA
    • The instance of itemB is 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 is 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 is merged into itemA
    • user-defined field values from itemB is merged into itemA
    • Any item, which has a dependency to itemB have that reference removed
    • all the children from itemB is made dependent to itemB parent(s)
    • itemB is deleted from the plan
    Sequenced Scenario

    Sequenced Scenario

    The figure depicts an offering, which has items that are in parallel and in sequence that have 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 is merged into itemB
    • User Defined Field's from itemA is merged into itemB
    • if itemA has dependent children those children are copied into itemB and the parent item of itemA
    • Any item, which has a reference to itemA have that reference erased
    • itemA is 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 are merged into comma-separated values from itemA and itemB
  • The planID is updated with the affinity plan ID
Note: When an order is submitted, the order lines for items, which have Affinity must have the AffinitySequnce defined and updated.
Note: To not merge certain User Defined Fields during Affinity Sequencing, those User Defined Fields must be added as a comma-separated values in the global variable CharacteristicsWithoutAffinityPostfix in the rules engine (Automated Order Plan Development).