DMN Date comparison using duration()

Hello guys,
I am trying to compare a give date (via DMN in FEEL expression) with current date weather it is between -9999 to 5 days if the date is in past it will return me negative value
but it is not able to parse the date => Failed to parse duration from β€˜2023-11-20’
I might be doing something wrong in this, can anyone please help me?

Thanks,
Shoeb

A singular datestamp won’t have duration.
You’ll probably want to do something like the example calculating the difference between to dates.

Thanks for replying @GotnOGuts but it is not working
@aravindhrs can you help me in this please

Regards,
Shoeb

duration(date(β€œ2023-11-19”) - today()) < 5 but for this I am getting these error logs
org.camunda.feel.FeelEngine : Suppressed failure: illegal arguments: List(ValDate(2023-11-19))
org.camunda.feel.FeelEngine : Suppressed failure: illegal arguments: List(ValDate(2024-03-02))
org.camunda.feel.FeelEngine : Suppressed failure: illegal arguments: List(ValDayTimeDuration(PT-2496H))

please help me with this

Kind Regards,
Shoeb

Hi @shoebsayyed118
I believe something as below expression should work.

(date(β€œ2023-11-19”) - today()).days < 5

https://docs.camunda.io/docs/components/modeler/feel/language-guide/feel-temporal-expressions/#subtraction

https://docs.camunda.io/docs/components/modeler/feel/language-guide/feel-temporal-expressions/#properties

Thanks you @hassang,
Actually ".days " is not working I am using camunda 7 here

Regards
Shoeb

Did you try it?

It should work as long as feel is the selected language

Hello @hassang here is what I got
(date(transaction.noc_date)- today()).days < 5

org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01008 Error while evaluating expression: failed to evaluate expression β€˜(date(transaction.noc_date)- today()).days < 5’: ValError(No property found with name β€˜days’ of value β€˜ValNull’. Available properties: ) is not comparable

kindly find attached a simplified working example



test_dmn.dmn (1.7 KB)

thanks it is working now

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.