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

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

Recommended Posts

Posted

Hello All

 

I would like to create a script (that displays a message) that is activated at startup when the current date falls between two specified dates. I tried the following:

 

If Get(CurrentDate) >= "01/12/2012" & Get(CurrentDate) <= "08/12/2012"    (DD/MM/YYYY date format)

   Beep

   Show Custom Dialog ["REMINDER NOTICE"; "Begin buying Christmas presents"]

End If

 

.... but it is not working! 

 

Any suggestions?

 

Frank

 

Posted

In addition to what Wim said:

 

 

You cannot compare a date to a text. Well, you can - but the results will not be what you expect. To compare the current date to some known date, use:

Get (CurrentDate) >= Date ( 12 ; 1 ; 2012 )

where both sides of the comparison are dates.

 

 

The other thing is that you should avoid hard-coding data into calculations and scripts; the way you have it now, the script will have to be modified every year.

Posted

Thank you Wim & comment!

 

I came across the Date function after I posted my original post but, even after using it, I was getting dialogs displaying when they should not have been. This was due to my use of "&" instead of "and". 

 

As per hard-coding actual dates into my scripts - the ability of FM to remind of things that require attention before certain dates more than offsets the need to update scripts, moreso when the database I created will be in use by non-technical staff.

 

Again thank you!

 

Frank

Posted
As per hard-coding actual dates into my scripts - the ability of FM to remind of things that require attention before certain dates more than offsets the need to update scripts, moreso when the database I created will be in use by non-technical staff.

 

Ahm... the idea is to use Filemaker abilities to avoid the need to update the script. For example:

Let ( [
today = Get (CurrentDate) ;
y = Year ( today ) 
] ;
Date ( 12 ; 1 ; y ) ≤ today and today ≤ Date ( 12 ; 8 ; y )
)

or:

Let ( 
today = Get (CurrentDate) 
;
Month ( today ) = 12 and Day ( today ) ≤ 12
)
  • Like 1
Posted

Oh dear, went to click plus and it is so tiny on iPad and it clicked -1 instead. And these rating will not allow change although they used to. My apology Michael! Maybe Lee can fix it!

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