Store a calculated date based off a set of conditions

I’m trying to save an expiration date that is based off of a few different conditional criteria.

This is to help pilots keep track of their different currencies and medical history.

For example: a pilot’s Third Class medical certificate, who is under the age of 40, expires 5 years after the date of examination.

I can get this calculation to work in a standard text field, using conditional statements. But I can’t save that value to the database.

Any suggestions?

What do you mean by “I can’t save that value to the database”?

Ideally, can you try to reproduce that in the forum_app so that we can have a look at a real case?

I meant that with the Visual Element “Text”, I can use conditions to achieve the calculated date, but that “Text” value can’t be stored. Only Input Forms are selectable in workflows, not Visual Elements.

In the attached image, the equation I’m trying to work out is:

IF[A<40 years old] AND IF[B=‘first class’] THEN[D=C+1year]
ELSE
IF[A>40 years old] AND IF[B=‘first class’] THEN[D=C+6months]
ELSE
IF[A<40 years old] AND IF[B=‘third class’] THEN[D=C+5years]
ELSE
IF[A>40 years old] AND IF[B=‘third class’] THEN[D=C+2years]
ELSE
IF[A<40 years old] AND IF[B=‘second class’] THEN[D=C+1year]
ELSE
IF[A>40 years old] AND IF[B=‘second class’] THEN[D=C+1year]

Right, we don’t make the text value accessible as that would make the list of elements super long. But what you can do is use an input element and make it read only (and remove the borders, etc) and then you’ll be able to access the value.

Ah, that certainly works! Thanks

1 Like