Use Case 1 - Calculating a customers 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.
Building 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.