Reputation: 15
In FileMaker 12 I'm trying to define a field based on a date, but it's not working. Here's what I'm using for the definition for fieldB: If (fieldA < 10/1/2014; "old"; "new"). Any suggestions?
Upvotes: 0
Views: 45
Reputation: 116982
Here's what I'm using for the definition for fieldB: If (fieldA < 10/1/2014; "old"; "new").
10/1/2014
is a mathematical operation that results in about 0.005
, and no date will ever be less than that.
Here's what you should be using:
If ( fieldA < Date ( 10 ; 1 ; 2014) ; "old"; "new" )
This assumes that:
fieldA
is a Date field;
the cut-off date is October 1, 2014 (otherwise you need to use Date ( 1 ; 10 ; 2014)
.
Upvotes: 2
Reputation: 422
It's hard to say for sure without more information (see comment on original post), but I just noticed that you've written the comparison fieldA < 10/1/2014
. To FileMaker's calculation engine, that means "10, divided by 1, divided by 2014".
UPDATE: As @michael.hor257k pointed out, just wrapping it in quotes ("10/1/2014"
) is not enough. However, you can both wrap it in quotes and use GetAsDate()
as follows:
If ( fieldA < GetAsDate ( "10/1/2014" ) ; "old" ; "new" )
Upvotes: 0