Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

if function using date inequality

Featured Replies

For some reason my if function is not working. It reads:

early? = If (date 2 < 7/1/2007; "y" ; "n" ) where date 2 is a date. Now, if I do a find using the criterion < 7/1/2007 on the date 2 field, I get a found set of records, but the early? field for all those records is "n", whereas it should be "y". In fact, all records have a "n" in that field. Any ideas why this formula doesn't work?

Edited by Guest

Try:

If( date 2 < Date( yourMonth ; yourDay ; yourYear ) ; "y" ; "n" )

Otherwise I believe you are saying that if date 2 is less than 7 divided by 1 divided by 2007, yes.

But it could be written different though:

Case ( theDate < GetAsDate ( "7/1/2007" ) ; "Y";"N")

...but is then dependent on localization following the OS setup.

--sd

  • Author

Thank you both. I combined your suggestions and re-wrote my function as:

If (date < GetAsDate ( "7/1/2007" ) ; "y" ; "n" )

and now it works! Yes, I see what you mean that FM would interpret 7/1/2007 as a fraction. ;)

Edited by Guest

I don't recommend you use get as date. If your system platform changes / you aren't using the file settings then it is likely to screw up i.e. use a dd/mm/yyyy format if you happen to get a normal user ;) -- hence why i didn't suggest it in my original post.

  • Author

Thanks for the tip. I studied some more about how date formats depend on local settings - sounds complicated. I re-wrote the formulas based on your method and they work great now! :wink2:

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.