Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Activating a script when the current date is between two specified dates

Featured Replies

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

 

don't use the & as a logical operator, use "and"

 

The ampersand is for concatenating text strings

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.

  • Author

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

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
)

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!

I took the - off, but someone else will have to hit the + 

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.