Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6364 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

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
Posted

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.

Posted

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

Posted (edited)

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
Posted

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.

Posted

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:

This topic is 6364 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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