you need to use the Case Function if this in a calculated field.
or is this for a script?
All events have an "end date" correct? That seems to be the only relevant date here to compare to the current date:
If ( EndDate < Get ( CurrentDate ) ; "Expired" ; "Active" )
This calculation, like any that use get ( CurrentDate ) must be unstored in order to evaluate correctly.
All of the events have a "date" (which is the start date). Only some of the events have an "end date" (because they last for multiple days). Unfortunatley all the records are already set up this way.
In that case, make it:
If ( max ( Date ; EndDate ) < Get ( CurrentDate ) ; "Expired" ; "Active" )
Thanks! Works great
I find this post really helpful... but I'm stuck in a really basic point.
I'm trying to create a magazine subscriptions, which feature the same active and expired command but somehow I can't get it to work.
I got two fields called subs valid from and till, and I want to create another field that just display if they expired or active. But I can't figure it out how to do the if and else if on the calculation fields, based on the post above
or maybe someone can just explain me how to do it from the beggining
many many thanks
In a calculation field you would use case.
Case ( Get ( CurrentDate ) > till ; "Expired"; "Active")
This says if todays date is greater than the date in your "Till" field then the calculation will display "Expired". If not greater than today's date display "Active".
If you wanted to also differentiate subscriptions that have not started yet as well.
Get ( CurrentDate ) < from ; "Pending";
Get ( CurrentDate ) > till ; "Expired" ;