Creative Wisdom ยท FileMaker Pro tipsArchive

Using date as a condition

Chong Ho (Alex) Yu, Ph.D., MCSE, CNE, CCNA (2001)

Problem

I am setting up a conference registration DB. I want to use a calculation field named "fee" to return the value of the conference fee based upon the registration date. Before December 31, 2001, the conference fee is $100. Afterwards, the fee will increase to $150. The following synatx appears to be logical but it doesn't work.

if (date <= 12/31/2001, 100, 150)

Solution

  • Create a new calculation field named "date_value".
  • In the calculation box, type "date". This will convert the registration date to a number.
  • In the field "date," type the "12/31/2001" or the deadline that you want to set to find out the numeric value of the deadline. FMP uses AD year 1 as the baseline. If the date is 12/21/2001, "date_value" will counts the number of days from 1/1/1 to 12/31/2001, and thus "date_value" will be "730850" (365 * 2001 + extra days from leap years)
  • In the calculation field "fee", type the following in the calculation box

if (date_value <= 730850, 100, 150)