AnsweredAssumed Answered

If statement comparing dates failing

Question asked by StefanZaryczny on Dec 16, 2013
Latest reply on Dec 16, 2013 by StefanZaryczny


If statement comparing dates failing


FileMaker Pro



Operating system version

OSX 10.8

Description of the issue

I am comparing two dates in an if statement and the comparison is failing.

For instance,

I'm triggering a script on a date type field upon exiting.

In the script I get the value of the date field using Get(ActiveFieldContents) and set to variable '$Pub'

Then I have an if statement

If $Pub > "01/09/2014"

Now if $Pub = '12/9/2013' the previous if statement evaluates as TRUE.  It should be FALSE.

Alternatively, if $Pub = '01/9/2013' the previous if statement evaluates as FALSE.  This is correct.

It's as if FM is looking at the month instead of the entire date including year.

I've been using the Data Viewer to confirm compared evaluated values.

I also tried assigning '01/09/2014' to a variable and comparing that to $Pub

Steps to reproduce the problem

Create a date field
Add a script trigger on exit

In script
Set Variable '$Pub' to Get(ActiveFieldContents)
If $Pub > "01/09/2014"

In browse mode
Add 12/9/2013 to date field and exit to trigger script

Expected result

If statement should evaluate as FALSE

Actual result

If statement evaluates as TRUE