Sign in to follow this  
Followers 0

Greater than date in a IF statement trouble

9 posts in this topic

Posted

Hi. I am trying to create an IF statement to determine if the Date Booked for an event is greater than 1/31/2012 AND if the record is tagged a certain company.

Right now I have...

If [services::Date Booked > 1/31/2012 and Event::INC_LLC = "LLC"]

Problem is, if it is an LLC event, it always validates true regardless of what the date is. What am I missing? Thanks, Rich

Share this post


Link to post
Share on other sites

Posted

1/31/2012 isn't a date.

Try: Date Booked > Date ( 1 ; 31 ; 2012 )

Share this post


Link to post
Share on other sites

Posted

Perfect. You're the best!

Share this post


Link to post
Share on other sites

Posted

If [services::Date Booked > 1/31/2012 ...

it always validates true regardless of what the date is. What am I missing?

Hi Rich,

To explain why the evaluation is breaking, FM sees 1/31/2012 as '1 divided by 31 divided by 2012'. The result is: .0000160328352466. So any Date Booked would evaluate as greater (except if empty). When working with dates, using date functions protects from this.

And welcome to FM Forums!! :laugh2: This is absolutely the best forum for FileMaker.

Share this post


Link to post
Share on other sites

Posted

an event is greater than 1/31/2012

Not directly related to your question, but in general it's best to avoid coding data directly into a calculation.

Share this post


Link to post
Share on other sites

Posted

Indeed, if I ran that calculation it'd fail (or produce very unexpected results) because that date is the 1 day of the 31st month in 2012.

Share this post


Link to post
Share on other sites

Posted

Indeed, if I ran that calculation it'd fail (or produce very unexpected results) because that date is the 1 day of the 31st month in 2012.

Which calculation do you mean?

Share this post


Link to post
Share on other sites

Posted

I think Vaughan is referring to australian date structure as being dd/mm/yy as distinct from the OPs mm/dd/yy

Share this post


Link to post
Share on other sites

Posted

I think so too - but the first calculation performs a division and the second one uses the Date() function. The results would be the same no matter which date format is in use.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0