A Script With A Time Span Comparison

A script that is only eligible for senior citizens has the following eligibility rules:

  • Customer class = Residential
  • Birth date equates to that of a senior citizen

These rules require only one eligibility group on the script. It would look as follows:

Group No. Group Description If Group is True If Group is False
1 Residential and Senior Citizen 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 account's customer class = R Check next condition Group is false Group is false
30 Person characteristic: Date of Birth Algorithm: True if senior Group is true Group is false Group is false

The first criterion is easy; it calls an algorithm that retrieves a field on the current account. This value, in turn, is compared to a given value. If the comparison results in a True value, the next condition is checked. 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 script isn't eligible).

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 a senior citizen. To pull this off, you can take advantage of a comparison algorithm supplied with the base script as described below.

  • Field to Compare. The person characteristic 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 SECC-TIMESPN for an example of this type of algorithm). Note that this time span algorithm can be used to compare days, weeks and months as well.

You'll notice that if a value of True is returned by the True if senior algorithm, the group is true (and we've set up the group to indicate a true group means the script is eligible).