Comparing dates and calculating time in calc fields

#1

I am trying to implement the following type of logic:

  1. Check the date for a certain type of event in a Status Set attached to my object
  2. Compare to today’s date and calculate difference in days
  3. Persist result

Can this be done as a stored calc, or should it be a metric or daily cronjob? Id like to store this on the type.

0 Likes

#2

you should be able to write it using a stored calc expression like: “(now() - yourDateField) / period(1,‘DAY’)”

0 Likes

#3

Ok great, and how will it invalidate/change? Once a day?

0 Likes

#4

every time yourDateField changes I believe it will recalculate this field. @trothwein can provide more details here.

0 Likes

#5

oh ok, so it wont change as the days change

0 Likes

#6

you might want to make it a read calc instead of a stored calc in this case. Since it should always give you the value on evaluation

0 Likes