Comparing dates which flow into DMN as variables

Hello fellow Camunda users,

I’m in a bit of a jam. I’ve been at it for some while now but as of yet I still haven’t been able to resolve my issue. Comparing dates with the standard operators and the date function is quite easy in Camunda. I thought this would be the same with using the variables as dates (and it might be) but I can’t seem to get it working.

Scenario: Suppose I have an activity which precedes my DMN table. From here out I get one variable date which is the today date(to keep it a tad easier). I get another variable date which could be any date. Suppose that I want to compare these 2 dates where the variable date that can be random should be at least 7 days further than the today date. Could anyone help me with this scenario? I’m hoping if I get a grip on this scenario I will be to use the result and the right notation to make more complex scenarios. Keep in mind that I could use expressions on a sequence line in a BPMN model but I’d rather use the variables in a DMN engine so bigger and more complex scenarios with more outputs can be handled.

Very big thanks for whoever can help me.

kind regards,

T.

Hi @kingspallett,
it would be easier to approach your problem, if you could post the sample BPMN and DMN models and corresponding code setting the date variables.

Hi @sdorokhova,

Thanks for your reply. I added my examples. One is a BPMN model where a variable will flow from the service task into my DMN task. The variable is a date. In my DMN I now have a working representation of how to compare that date with the two rules. I am now looking to add to these rules years, days, hours or any other timeframe. To clarify: I’d like the variable compare to xx-xx-xxxx + 3 days(or hours, seconds, years). Have you got a formula for this? I’m guessing this has to be done in Juel through an expression or I have to download an extension for FEEL. Either way, does someone have the right format for me to pull this off? Preferably in Juel AND FEEL.

kind regards,

Ttestgetalbpmn.bpmn (2.9 KB)
testgetaldmn.dmn (1.4 KB)

Hi,
I also was trying to the same thing but couldn’t achieve expected output. I have the same thing in mind do we have to download an extension for FEEL or can someone tell me the right format?

date and time(“2018-11-11T12:11:11”).plusDays(3) - this didnt work for me in the decision table input entry.

duration() in an input expression should do the trick in FEEL, see https://github.com/camunda/feel-scala/wiki/FEEL-Language-Guide.

date and time("2017-01-10T10:30:00") - duration("PT1H")

Input expressions are FEEL by default, but the default Camunda engine only supports a restricted FEEL dialect which does not include duration, the feel-scala extension however is much more advanced. See its wiki to learn how to add it.

1 Like