Ric Barline Posted June 16, 2007 Posted June 16, 2007 (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 June 16, 2007 by Guest
Genx Posted June 16, 2007 Posted June 16, 2007 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.
Søren Dyhr Posted June 16, 2007 Posted June 16, 2007 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
Ric Barline Posted June 22, 2007 Author Posted June 22, 2007 (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 June 22, 2007 by Guest
Genx Posted June 22, 2007 Posted June 22, 2007 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.
Ric Barline Posted June 23, 2007 Author Posted June 23, 2007 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:
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now