Jump to content

IF statement comparing dates


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

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 8386 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.