Tinderbox Forum

Conditional display expression

Is it possible to use conditionals in display expressions?

I have user attributes for date of birth and date of death (and one for if they’re still alive). I want it to show someone’s age if it’s able to be calculated (i.e. we have a DOB and they’re alive, or if we have a DOB and Date of death). Can I write code to that effect in the Display Expression box?

Yes … but …

\1. Yes! A DE can certainly can do this. Trivial example:

then tick $MyBoolean:

\2. But … do see the warnings here re getting too carried away with calculations within the DE, especially if applied to a lot of notes. In the latter circumstance it is better to cache the calculated value and call that in the DE as explained in the linked-to article.