If/Then in Field Value Expressions

Need some help troubleshooting this. For each Rank record, there is an Effective Date, a Removed Date, and a Time in Grade value. Time in Grade is defined as the difference in months between Removed Date and Effective Date, or if no Removed Date has been entered, the difference between today’s date and Effective Date. I’m currently trying this as a Field Value Expression for Time in Grade:

rankRemovedDate>0 ? sub (rankRemovedDate, rankEffectiveDate) / 2592000000 : sub (now(), rankEffectiveDate) / 2592000000

It’s not working. Any suggestions on how I can fix this?

Try removing the logic test for > 0 … and test if the field is empty:

rankRemovedDate ? sub (rankRemovedDate, rankEffectiveDate) / 2592000000 : sub (now(), rankEffectiveDate) / 2592000000

By testing for > 0, if the field is empty, your logic test fails.

If this doesn’t meet your requirements, I would use a workflow.

1 Like

That seems to have worked. Thanks much!

1 Like