August 1, 200124 yr I am using a series of FMP-IF statements to display my records on my website. One of the FMP statements is comparing the date of two FMP-fields with eachother and displays the one that is most recent. Well, that's what it is supposed to do, anyway. However, there seem to be some problems with that. The IF-statement I use is this: [FMP-IF: Field:responses::ResponseDate .gt. Field:mm_stats::PostDate] some action [FMP-ELSE] some other action [/FMP-IF] In the example I am having difficulties with, the ResponseDate is 1/8/2001 and the PostDate is 28/7/2001. If I am not mistaken, the IF statement should be true and therefore the first action should take place. Right? Well, that's not what happens! For some reason the second action is taking place. It almost seems as if Filemaker thinks the 1st of August 2001 is not greater than the 28th of July 2001. Could it be the format of the date that makes difficulties? It is weird. The IF-statement sometimes works and sometimes doesn't I can't really figure out what differs the dates from eachother. I think it is the month in the date - if that is different between ResponseDate and PostDate, the IF-statement doesn't work the way it should. Can anybody help?
August 1, 200124 yr Andreas, I'm guessing that the IF statement is using the string values of the date. Unfortunately, I don't have a solution right at the moment. Garry
August 2, 200124 yr Whenever I get tricky stuff like this, I try to do it in the database rather than the web page. Make a calc field in the db and display the result on the web page.
August 2, 200124 yr It may be that .gt does not work on dates. If so you may need to calculate to a number or a text field. Or set the calculation in the database if you can such that the difference is worked out there as perhaps a boolean.
August 2, 200124 yr Author I've taken your advice and created a new field in FM wher I make the caluclation. Works fine now, thanks. I was just wondering whether anybody knew where the problem was because it worked fine until the moment the month in the two dates differed from eachother. Well, it's working now and I am actually quite happy to get rid of this incredible FMP-IF statement I had in my files.
August 3, 200124 yr Andreas asked: I was just wondering whether anybody knew where the problem was because it worked fine until the moment the month in the two dates differed from eachother. I believe this is because it was looking at string versions of the date. Garry
Create an account or sign in to comment