Add to start up script.
Set Error Capture [On]
Go to Layout //where birthday field resides
Enter Find Mode [ ]
Set Field [ Table::Birthday; Get(CurrentDate)
If [not Get(FoundCount)]
Show Custom Dialog (No birthdays today.)
//This will leave you on a layout with no records selected, so more steps may be necessary
//If you have records you will be on a record, or records of the found set.
//You could go right into sending emails
That will only works for newborns … … who probably don't have their own mail address yet.
I think the OP needs discrete day and month fields – or, using ExecuteSQL(), a global and a relationship …
Set Variable [ $birthdayIDs ;
ExecuteSQL ( "
WHERE DAY ( DOB ) = ? AND MONTH ( DOB ) = ?
" ; "" ; "" ; Day ( Get ( CurrentDate ) ) ; Month ( Get ( CurrentDate ) )
If [ not IsEmpty ( $birthDayIDs ) ]
Set Field [ Table::gFoundIDs ; $birthDayIDs ]
Go to Related Record [ from: Contacts_byFoundIDs ; layout: Contacts_list ; related only ]
# [ send mail etc. ]
You should also have a field in a Globals/Utility table to store the last date you sent these mails.
Then do a check at the beginning of the script – you don't want to send these mails twice on the same day
Yeah forgot to trim the year off of it...
How about this?
Set Variable [$day;Vale:Month ( Get ( CurrentDate ) ) & "/" & Day ( Get ( CurrentDate ) ) & "/*"]
Set Field [Table::Birthday; $day}
This setup is going to be running on a p2p filemaker setup. The one pc thats hosting it just basically sits at the main screen. This solution will never really close, knowing this... should this be on an ontimer script ?
If you are not running FMP server (that can run scripts at timed intervals), I would put it on a opener script, that runs when you turn the machine on in the morning.
Yeah but the issue with that is the machine probably will never turn off. Any other work around?
Can 'Install On Timer Script' work for you?
Yes that would be fine . Would i have it still as a startup script?
Create your b'day script.
Use 'Install On Timer Script' step in new script, select b'day script as the script and select interval as 86400
60 (sec/min) X 60 (min/hr) X 24 (hrs/day)
Just remember the script will wait 24 hours before running the first time. So run it manually the first day, and run it manually if you ever shut the computer off and back on.
Ok so i switch over to filemaker server, the peer to peer setup is awful. I want to make this a server side script that runs. What is the easiest way for me to do this ?