Distribution Rule
Distribution rule is a set of criteria fields based on which the data is actually distributed to the set of receivers. So by modeling a rule a developer can set the logic on which the data will be distributed to mobile devices according to the distribution requirement.
In case of distribution rule, the Set-B is filled with one or more criteria fields and an operator on them, is modeled.
There are different ways in which distribution logic can be defined. The distribution rule can be of following types based on criteria fields mapping:
1. Constant Rule
2. Date Pattern
3. Device attribute mapping
4. Subgen Mapping
In case of constant rule set-B is filled with static criteria filed values which will be used as distribution criteria.
In case of Date pattern set-B is filled with date pattern values which will be used as distribution criteria
In case of Device attribute mapping set-B is mapped to device attributes which will be filled at runtime to be used as distribution criteria.
Here will take the example scenario for constant value based rule.
Let us take an example and see the same. In the example, the users are supposed to meet customer and address the customer's concerns. Each user gets an update on their device about the customer, based on the update user goes and meet the customer, update the customer status. Further for simplicity assume each device is having one and only one user, and similarly each user is assigned to one device only.
Let the following list represent the available users/receivers in the system:
Receiver | Location |
RCVR-A | Loc-A |
RCVR-B | Loc-B |
RCVR-C | Loc-C |
RCVR-D | Loc-D |
All receivers are assigned the DM-SWCV where the rule is modeled.
Let the records of customer object are having following fields: Name, type, item ordered and quantity.
So suppose the set-A, as identified by CDS table entries look like:
Name | Type | Item Ordered | Location | Quantity |
CUSTOMER-A | T2 | ITEM-1 | Loc-A | 50 |
CUSTOMER-B | T3 | ITEM-2 | Loc-B | 65 |
CUSTOMER-C | T4 | ITEM-3 | Loc-C | 45 |
CUSTOMER-D | T2 | ITEM-1 | Loc-D | 50 |
CUSTOMER-E | T3 | ITEM-2 | Loc-D | 65 |
CUSTOMER-F | T4 | ITEM-3 | Loc-D | 70 |
Let us consider the business case in which the sales person needs to deliver the orders to the customer if the customer has ordered more than 60 items. So to meet this distribution criteria, we can model a rule with the criteria field "quantity > 60".
At the time of evaluation of such rule, the Cartesian product of CDS table entries (set A) is taken with receivers (set C) with the condition "quantity >60" to finally form set D i.e. {I, D} pair.
If the option ‘None' is chosen: Then system does not identify the receivers as participating in the rule. Rather now administrator needs to explicitly assign receiver to rule. Suppose in this case, administrator assigns only RCVR-B to rule. So the set-C will now look like:
Receiver |
RCVR-B |
The set- B will look like
Receiver | Operator | Quantity |
RCVR-B | GT | 60 |
In this case the set-S ({((CF, Op), R)} will turn out to be
{((Quantity, >), RCVR-B)}), which says the data from set A i.e. CDS table should be sent to RCVR-B where in it satisfies "Quantity > 60" resulting in set-D. So the final output i.e. set-D will come out:
So in this case, the set-D, final output will look like:
Instance | Receiver |
CUSTOMER-B | RCVR-B |
CUSTOMER-E | RCVR-B |
CUSTOMER-F | RCVR-B |
This is calculated by taking the Cartesian product of set A and set S based on the condition "quantity > 60".
In this case, the evaluation will take place
i- Whenever rule is activated or de-activated, or
ii- when administrator assign or un-assigns receiver from rule, or
iii- Whenever the DM-SWCV for the assigned receiver is changed.
If the option ‘All' is chosen: as all the receivers are assigned the DM-SWCV, system will identify all of them for participation in the rule. The set-C will now look like:
Receiver | Location |
RCVR-A | Loc-A |
RCVR-B | Loc-B |
RCVR-C | Loc-C |
RCVR-D | Loc-D |
So, in this case, the set-D will appear as follows:
Instance | Receiver |
CUSTOMER-B | RCVR-A |
CUSTOMER-E | RCVR-A |
CUSTOMER-F | RCVR-A |
CUSTOMER-B | RCVR-B |
CUSTOMER-E | RCVR-B |
CUSTOMER-F | RCVR-B |
CUSTOMER-B | RCVR-C |
CUSTOMER-E | RCVR-C |
CUSTOMER-F | RCVR-C |
CUSTOMER-B | RCVR-D |
CUSTOMER-E | RCVR-D |
CUSTOMER-F | RCVR-D |
In this case, the evaluation will take place
i- Whenever rule is activated or de-activated, or
ii- Whenever the DM-SWCV for the assigned receiver is changed.
If the option "Receiver attribute" is chosen:
Receiver | Location |
RCVR-D | Loc-D |
And hence the final result in Set-D will look like:
Instance | Receiver |
CUSTOMER-E | RCVR-D |
CUSTOMER-F | RCVR-D |
In this case, the evaluation will take place:
i- Whenever rule is activated or de-activated, or
ii- whenever the DM-SWCV for the assigned receiver is changed, or
iii- When the receiver's attribute is changed. In this example, whenever the Location attribute's value is changed.
(b) Instead of statically defined value of Location=LOC-D, one can use the subscription generation data object to fetch the value of attribute Location to be considered.
Supposing a subscription generation data object is used having following values for field used for describing receivers attribute ‘Location':
Location |
LOC-B |
LOC-E |
So in this case, system will identify only Receiver - Rcvr-B to be participating in the rule. The set-C will look like:
Receiver |
RCVR-B |
And so the final result in the Set-D in this case will look like:
Instance | Receiver |
CUSTOMER-B | RCVR-B |
CUSTOMER-E | RCVR-B |
CUSTOMER-F | RCVR-B |
In this case, the evaluation will take place whenever:
i- rule is activated or de-activated, or
ii- when administrator assign or un-assigns receiver from rule, or
iii- whenever the DM-SWCV for the assigned receiver is changed, or
iv- when the receiver's attribute is changed or
v- Whenever the attribute value gets changed in subscription generation data object.
In all the above cases, after the rule is activated in the portal, any insert or delete message for the data object will be evaluated for updating mapping information to relevant receivers.
Similarly, the user can create a distribution rule with different set of operators such that "<=", ">", ">=", "=", "! =", "between" and "CP (Contain Pattern)".
CP operator is used in a business scenario where the user needs to distribute the data of one specific pattern. For example, a user can define a distribution rule saying
Item CP ‘Item*'. In this case if the instance belongs to this pattern like Item-1, Item-2 etc will be distributed.