I have made a calculation based on dates to calculate an age of somebody.
I use the current date – birthdate. Although is probably not the most accurate, it works wouldn’t it that Triggre uses roundings. Is there a way to solve this ?
I have made a calculation based on dates to calculate an age of somebody.
I use the current date – birthdate. Although is probably not the most accurate, it works wouldn’t it that Triggre uses roundings. Is there a way to solve this ?
Hello,
Could you provide me with an example?
I have a DB (Child) with the following fields: Name / date of birth / Place of birth / Age.
In a user flow I do the following:
Start with the DB Child → step 1 → calculation ( Current date – date of birth)
step2 → Calculation (result step 1 / 1 days) = convert the value in to days
step 3 → Calculation (result step 2 / 365,33) = age in years
step 4 → edit data (field age / DB Child) with the value from step 3.
Example:
Current date 31-08-2020 – DOB 26-09-2011 result = 9
Current date 31-08-2020 – DOB 09-07-2019 result = 1
The second one is correct, but the first example is not 9 yet
Steven,
Rounding is automatically executed in Triggre. In the first case the value will be something like 8.92 which is rounded to 9. Which is a standard rounding. To get the result you’re looking for you have three options:
Option number 1:
Store the age in a data-item with a property with more than 0 decimals.
Option number 2:
Let’s assume someone can’t get older than 99, for this example. You can extend this to > 100 by adding another decision to your flow part.
We need to do the following steps:
Let’s use an example for this. The age is 8.92
Option number 3:
The concept behind option number 3 can be very useful in other situations as well. The general idea behind it is that we look up the value in a table and use a referenced value linked to that table.
We need to do the following steps:
Let’s use an example for this. The age is 8.92