***ANDY*** Posted March 2, 2005 Posted March 2, 2005 Dear All, I have searched for this in the Forum and have also found some solutions but it was for fmp7 and I guess I can't use the same syntax for my script in fmp5. Here's what I'd like to do: at opening of the databse I want to assign a script (at edit/prefs/document...) that runs and finds the birthday of somebody - but one day before his actual birthday, so I can send him a card or email etc. I have tried to calculate my field DOB in the script, set field to ... etc etc but haven't gotten to the proper syntax - I give up! Thanks for your help... Andy
comment Posted March 2, 2005 Posted March 2, 2005 The calc would be: Day ( DOB ) = Day ( Status (CurrentDate) + 1 ) and Month ( DOB ) = Month ( Status (CurrentDate) + 1 ) You could put this in a calc field cBirthday (result is number, unstored) and find records where cBirthday = 1. Or, you could add a field cBirthday (result is text, stored) = Month ( DOB ) & "|" & Day ( DOB ) Then in your find script go to Find mode and set field cBirthday to: Month ( Status (CurrentDate) + 1 ) & "|" & Day ( Status (CurrentDate) + 1 ) --- EDIT --- I am afraid I don't have an elegant solution for those who have been born on February 29. Let me think...
-Queue- Posted March 2, 2005 Posted March 2, 2005 How about an unstored calc field of Date( Month(DOB), Day(DOB), Year(Status(CurrentDate)) ) - 1 ? Then you can perform a find for today's date in it. Unless you have thousands of records, this shouldn't be too slow.
***ANDY*** Posted March 3, 2005 Author Posted March 3, 2005 Thank you guys, I have adopted Queue's version, it works fine and it looked a little simpler to me right now but I will play around with comment's example as well just for the heck of it... Thanks again...
***ANDY*** Posted March 3, 2005 Author Posted March 3, 2005 One more thing in regards to this: if my scsript doesn't find a birthday, is there a way to eliminate the error message "no matching records found"? It might confuse my users a little if the message pops up every day. Thanks, Andy
RalphL Posted March 3, 2005 Posted March 3, 2005 At the beginning of your script use Set Error Capture on. This will remove the error message, but you now must tell FMP (in your script) what to do if there are no found records.
Recommended Posts
This topic is 7204 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 accountSign in
Already have an account? Sign in here.
Sign In Now