A Package With A Time Span Comparison
The Senior Citizen Package has the following eligibility rules:
- Customer class = Residential
- Division = California
- Birth date equates to that of a senior citizen
These rules require only one eligibility group on the package. It would look as follows:
Group No. |
Group Description |
If Group is TRUE |
If Group is FALSE |
1 |
Residential, Calif, Senior |
Eligible |
Ineligible |
The following criteria will be required for this group:
Group 1: Residential, Calif, Senior |
|||||
Seq |
Field to Compare |
Comparison Method |
If TRUE |
If FALSE |
If Insufficient Data |
10 |
Algorithm: retrieve order's customer class |
= R |
Check next condition |
Group is false |
Group is false |
20 |
Algorithm: retrieve order's division |
= CA |
Check next condition |
Group is false |
Group is false |
30 |
Misc Field On Order: Date of Birth |
Algorithm: True if senior |
Group is true |
Group is false |
Group is false |
The first two criteria are easy; they simply retrieve a field on the order and compare it to a given value. If the comparison doesn't result in a TRUE value, the Group is false (and, the group indicates that if the group is false, the customer isn't eligible for the package). If the comparison results in a TRUE value, the next condition is checked.
The last criterion contains a time span comparison. Time span comparisons are used to compare a date to something. In our example, we have to determine the age of the customer based on their birth date. If the resultant age is > 65, they are considered to be a senior citizen. To pull this off, you can take advantage of a comparison algorithm supplied with the base package as described below.
- Field to Compare. The miscellaneous field in which the customer's birth date is held is selected.
- Comparison Method. We chose a comparison algorithm that returns a value of TRUE if the related field value (the customer's date of birth) is greater than 65 years (refer to PKCC-TIMESPN for an example of this type of algorithm).
You'll notice that if a value of TRUE is returned by the True if senior algorithm, the group is true (and we've setup the group to indicate a true group means the customer is eligible).
The time span algorithm can be used to compare days, weeks, months, etc. Refer to PKCC-TIMESPN for more information about this algorithm.