Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hello,

I want to compare some dates in a script, and then perform an action based on an IF statement. Here's the pseudocode:

IF (date is between date1 and date2)

...perform action...

How would I do that in a Filemaker script?

Regards,

Evan

Posted

Is the date which you want to compare a field in your database? If so, sounds like you need global fields for date1 and date2.

A little more info could be helpful for a more precise script example.

-Courtney

Posted

Hi,

This depends on whether you are hardcoding the dates into the script or picking the dates up from 2 fields - here are both ways...

I have used an example where it checks a field called TestDate and if it is between 01 Jan 2003 and 31 Dec 2003 it shows a message saying this year, else it shows a message saying Not this Year.

Hardcoding the dates in the script:

If["TestDate >= Date( 01, 01 , 2003 ) and TestDate <= Date( 12, 31 , 2003 )"]

Show Message["This Year"]

Else

Show Message["Not this Year"]

End If

Picking the dates up from 2 fields:

If["TestDate >= Date( Month ( RangeStartField), Day ( RangeStartField) , Year ( RangeStartField)) and TestDate <= Date( Month ( RandEndField), Day ( RangeEndField) , Year ( RangeEndField) )"]

Show Message["This Year"]

Else

Show Message["Not this Year"]

End If

Regards

Eddy

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