Msaeed 0 Posted October 7, 2020 Share Posted October 7, 2020 Hi All, As per mentioned on topic I Would like ask someone to help me this issue because I am trying more than time unfortunately all is not successful to send e-mail for birthday in case have in the same day more than one employee. on filemaker server : Link to post Share on other sites
Jim Gill 4 Posted October 8, 2020 Share Posted October 8, 2020 (edited) This makes the assumption that the field "Birthday::C_Birthday" has a format of mm/dd/year: Allow User Abort [ Off ] Set Error Capture [ On ] Go to Layout [ Birthday List ] Set Variable [ $bdate_find; Value: Let ( [ ~bday = Day ( Get (CurrentDate)); ~bmonth = Month ( Get (CurrentDate)) ];~bmonth&"/"&~bday&"/*" ) ] Perform Find [ Specified Find Requests: Find Records; Criteria: Birthday::C_Birthday: “$bdate_find” ][ Restore ] If [ Get (LastError)=401 ] Exit Script [ ] Else Go to Record/Request/Page[ First ] Loop Send Mail [ Send via SMTP Server ][ No dialog ] Go to Record/Request/Page[ Next; Exit after last ] End Loop End If Exit Script Edited October 8, 2020 by Jim Gill 1 Link to post Share on other sites
Msaeed 0 Posted October 9, 2020 Author Share Posted October 9, 2020 Thank you is working perfect... Link to post Share on other sites
comment 1,777 Posted October 10, 2020 Share Posted October 10, 2020 (edited) Two side notes: 1. You can find people whose birthday is today, regardless of the date format in use, by: Enter Find Mode [ ] Set Field [ Employees::DateOfBirth; Substitute ( Get (CurrentDate) ; Year ( Get (CurrentDate) ) ; "*" ) ] Perform Find [ ] 2. If you run such script on a daily basis, you will miss people whose birthday falls on a weekend or holiday. In addition, people born on February 29 will be skipped in 3 out of 4 years. Edited October 10, 2020 by comment 1 Link to post Share on other sites
Msaeed 0 Posted October 10, 2020 Author Share Posted October 10, 2020 thanks a lot for clarification, how can skip this issue people born on February 29 will be skipped in 3 out of 4 years.? Link to post Share on other sites
comment 1,777 Posted October 10, 2020 Share Posted October 10, 2020 If you intend to run this daily, then you need to make sure that if today is February 28 in a non-leap year, the search will find people born on February 28 as well as people born on February 29. That means setting the searched date field to something like: Let ( today = Get (CurrentDate) ; If ( DayOfYear ( today ) = 59 and Month ( today + 1 ) = 3 ; Substitute ( Date ( 11 ; 22 ; 3333 ) ; [ "11" ; "2" ] ; [ "22" ; "{28..29}" ] ; [ "3333" ; "*" ] ) ; Substitute ( today ; Year ( today ) ; "*" ) ) ) --- P.S. Do people still appreciate getting an automated birthday greeting? 1 Link to post Share on other sites
Msaeed 0 Posted October 10, 2020 Author Share Posted October 10, 2020 Where I put this calculation ? Actualy yesterday I try very thing working fine. Link to post Share on other sites
comment 1,777 Posted October 10, 2020 Share Posted October 10, 2020 (edited) 4 minutes ago, Msaeed said: Where I put this calculation ? Here: Enter Find Mode [ ] Set Field [ Employees::DateOfBirth; «CALCULATION GOES HERE» ] Perform Find [ ] 4 minutes ago, Msaeed said: Actualy yesterday I try very thing working fine. Not sure what you mean by that. Yesterday was not February 28 in a non-leap year. Edited October 10, 2020 by comment 1 Link to post Share on other sites
Msaeed 0 Posted October 10, 2020 Author Share Posted October 10, 2020 I will try to change the date and update you asap. Link to post Share on other sites
Jim Gill 4 Posted October 20, 2020 Share Posted October 20, 2020 @Comment On 10/10/2020 at 3:47 AM, comment said: Enter Find Mode [ ] Set Field [ Employees::DateOfBirth; Substitute ( Get (CurrentDate) ; Year ( Get (CurrentDate) ) ; "*" ) ] Perform Find [ ] I'm not a developer (just love FMP - ehh Claris) - curious why the three steps and not just the single step? So replace the quoted above with this: Perform Find [ Specified Find Requests: Find Records; Criteria: Employees::DateOfBirth; Substitute ( Get (CurrentDate) ; Year ( Get (CurrentDate) ) ; "*" ) ][ Restore ] Appreciate your insight! Link to post Share on other sites
comment 1,777 Posted October 20, 2020 Share Posted October 20, 2020 (edited) Because you cannot perform calculations in a find request. You could - if you wanted - reduce this to two steps by using a variable. But the 3-step method has the advantage of showing exactly what's going on without requiring the reader to examine the find requests. Edited October 20, 2020 by comment Link to post Share on other sites
Jim Gill 4 Posted October 20, 2020 Share Posted October 20, 2020 Got it! Thank you for the enlightenment - totally makes sense now that you have said it. You probably just saved me at least an hour of frustration in some future scripting endeavor! Thanks again!! Link to post Share on other sites
Recommended Posts
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