Hello,
I would like to make a decision based on the age of a person in the DMN. As input I can only enter the date of birth. How can I use the Literal Expression to calculate the age and check in the DMN whether the person is older or younger than 18?
Hi @fabiannaether,
there is a nice playground to build and test feel functions: Try out and learn DMN FEEL - FEEL Playground
My result is:
substring after(
substring before(
string(
years and months duration(
date(birthday),
today()
)),
"Y"),
"P")
You can find the feel functions and expressions here: What is FEEL? | Camunda Platform 8 Docs
Hope this helps, Ingo
Addition: input is
{
"birthday": "1969-05-31"
}
output is
"53"
Hello @Ingo_Richtsmeier,
thank you for the message. If I create this as a Decision Table and then try to simulate this in the DMN Simulator, I get the following error message:

If I put in a hardcoded date instead of today(), then it works. Have I made a mistake in the DMN file? Attached is the file.
AgeDMN.dmn (2.9 KB)
You could simplify the FEEL expression a bit by using the years
property of the duration.
years and months duration(date(birthday), today()).years
It is an example from Temporal Samples | FEEL-Scala
3 Likes
Hello @Philipp_Ossler,
thank you for the message. Unfortunately, the same error appears. Why is the today() function not recognised?

It seems that the DMN simulator is outdated. 
cc: @Ingo_Richtsmeier