Filter forms with case property changed in the last 5 minutes

Hi,

I hope someone help. I'm trying to use the logic of the "date(last_modified) != today()" but for cases who have had a property edited in the last 5 mins. I'm using the double(now()) to anchor the logic in time, but it's not working.

Thanks
Toby

Dealing with minute level datetimes is a bit tricky. The main limitation is that the engine doesn't retain the ability to convert a date into more granular units than days once it has been serialized into a property.

For you particular case it sounds like you could just store the output of

if(/data/meta/timeEnd = '', '', double(now()))

to a new case property, and then do the double comparison against that property in your list instead of date(last_modified).

Adding /data/meta/timeEnd to the expression just prevents the date from being evaluated until the form is completed since some of the form engine contexts will lock in the instant that now() refers to so that the form can be more consistent.

-Clayton

Thanks, this worked perfectly.

After hacking about, the formula below filters for 5 minutes after the case property has been updated.

double(now()) > double(time) +double(0.005)

Thanks, much appreciated!
Toby

Great!

That expression looks like it has the right structure, but as a heads up I think the 0.005 might be slightly off for the unit of time you want to add.

double(now()) expresses the time since the epoch in days and fractional days, so I think 5 minutes would be as below (or you could always just leave the calculation itself in the expression)

((1 / 24) / 60) * 5 = 0.00347

Cool thanks, that's really helpful!