A field with an identity crisis
I have a layout region with a pop-up calendar for the users' birthdays. I have another field that is supposed to calculate the users' ages. The age (number/computed) field has the following formula but it causes an error stating that it should be a date/time field. Unfortunately this also fails when I change it to date/time format:
@Text(@If(@Month(@Today)
@Month(Birthday); @Year(@Today) -
@Year(Birthday); @If(@Day(@Today)
< @Day(Birthday);
(@Year(@Today) - @Year(Birthday)) - 1;
@If(Birthday = ""; "Ageless"; @Year(@Today)
- @Year(Birthday)))))
Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.
The check if the birthday field is empty or not is done at the end of the formula. In the event that birthday is empty, the beginning of your formula will fail. This is because your are performing date/time functions on an empty value, which is not allowed. Move the check for an empty Birthday field to the top of the formula. For instance:
@If(Birthday="";"Ageless";
<<<your formula here>>>)
Do you have comments on this Ask the Expert Q&A? Let us know.
Dig Deeper
-
People who read this also read...
This was first published in July 2003