June 16, 200718 yr 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, 200718 yr by Guest
June 16, 200718 yr 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.
June 16, 200718 yr 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
June 22, 200718 yr 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 June 22, 200718 yr by Guest
June 22, 200718 yr 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.
June 23, 200718 yr 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