December 28, 201213 yr 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
December 28, 201213 yr don't use the & as a logical operator, use "and" The ampersand is for concatenating text strings
December 28, 201213 yr 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.
December 29, 201213 yr 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
December 29, 201213 yr 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 )
December 29, 201213 yr 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!
Create an account or sign in to comment