Use case 1 - Calculate a customer's age
In this use case, we'll create an eligibility rule that uses the difference between the current date and a customers date of birth, provided by your CRM, to calculate a customers current age. This provides you with a new data item (customer age) in a user-friendly format. You could use this data item within another eligibility rule, for example, to provide someone over 65 with a discount.
Requirements
-
Age should be returned in years.
-
Age should be returned as an absolute number.
-
Age should be rounded down to age at previous birthday. For example, you want a customers age to be calculated as 20 until the day they actually turn 21.
Build your eligibility rule
You can build this eligibility rule using the following functions:
-
absolute of ...
-
floor of ...
-
time between ... and ... in ...
-
now
-
dateOfBirth (provided by your CRM)
Example
absolute value of floor value of time between now and dateOfBirth in "years"
Where:
now equals 21st March 2014
dateOfBirth equals 11th April 1943
Returns customer age as 71.
