March 7, 201411 yr Hi All, I have an issue with a calculation and I cannot seem to figure it out. I run a theatre school and have pulled field to create a register where parents/members can sign in. On the box where the signature goes I wanted to display the words "Happy Birthday" when i its the members Birthday within the next 10 days. However the code I have displays the words with regardless and I cannot see where I am going wrong. The calculation also displays a number directly after the word i.e HAPPY BIRTHDAY1, HAPPY BIRTHDAY2. I am using FM starting point as my base and working in FM13. Any help would be greatly received as I am a complete beginner. LeftWords("HAPPY BIRTHDAY";2) & (Abs(Date(Month(Get(CurrentDate)); Day(Get(CurrentDate)); 1997) + 10 - Date (Month(Birthday);Day(Birthday); 1997)) <= 10)
March 7, 201411 yr Hi All, I have an issue with a calculation and I cannot seem to figure it out. I run a theatre school and have pulled field to create a register where parents/members can sign in. On the box where the signature goes I wanted to display the words "Happy Birthday" when i its the members Birthday within the next 10 days. However the code I have displays the words with regardless and I cannot see where I am going wrong. The calculation also displays a number directly after the word i.e HAPPY BIRTHDAY1, HAPPY BIRTHDAY2. I am using FM starting point as my base and working in FM13. Any help would be greatly received as I am a complete beginner. What do you want the message to say? Just happy birthday or happy birthday and something else?
March 7, 201411 yr Author What do you want the message to say? Just happy birthday or happy birthday and something else? It would be nice to say "Happy Birthday from all at TTA". Thank you for your reply.
March 7, 201411 yr It would be nice to say "Happy Birthday from all at TTA". Thank you for your reply. Well I would set up a calculated field for the message with the formula: If ( Birthday ≥ Get ( CurrentDate ) and Birthday ≤ Get ( CurrentDate ) +10 ; "Happy Birthday"; "") If ( Day (Birthday) ≥ Day ( Get ( CurrentDate )) and Day (Birthday) ≤ Day ( Get ( CurrentDate))+10 and Month( Birthday )= Month( Get (CurrentDate)) ; "Happy Birthday"; "") See comments post below me!
March 7, 201411 yr If ( Birthday ≥ Get ( CurrentDate ) and Birthday ≤ Get ( CurrentDate ) +10 ; "Happy Birthday"; "") I doubt that Birthday will be ≥ the current date …
March 7, 201411 yr The calculation also displays a number directly after the word i.e HAPPY BIRTHDAY1, HAPPY BIRTHDAY2. That's not accurate: it never displays "HAPPY BIRTHDAY2". It shows either "HAPPY BIRTHDAY1" or "HAPPY BIRTHDAY0", depending on the condition being true or false. If you want the condition to affect the result, use it inside an If() or Case() function, for example: If ( Abs(Date(Month(Get(CurrentDate)); Day(Get(CurrentDate)); 1997) + 10 - Date (Month(Birthday);Day(Birthday); 1997)) <= 10 ; "HAPPY BIRTHDAY" ) Note that: 1. LeftWords ("HAPPY BIRTHDAY" ; 2 ) is exactly the same thing as "HAPPY BIRTHDAY"; 2. Your test will return true for 20 days following the birthday, not 10; 3. Your test will fail towards the end of the year.
March 7, 201411 yr and Month( Birthday )= Month( Get (CurrentDate)) Your calculation will never say "Happy Birthday" to people whose birthday is next month - even if today is the last day of the month and their birthday is tomorrow.
March 7, 201411 yr Your calculation will never say "Happy Birthday" to people whose birthday is next month - even if today is the last day of the month and their birthday is tomorrow. Oh Yer :-(
March 7, 201411 yr OK, so if I may chime in, too … Let ( [ t = Get ( CurrentDate ) ; inFinal10 = Month ( t ) = 12 and Day ( t ) > 21 ; target = Date ( Month ( Birthday ) ; Day ( Birthday ) ; Year ( t ) + inFinal10 ) ] ; Case ( target >= t and target <= t + 10 ; "Happy Birthday from all at TTA." ) ) If you want something like “Happy 25. Birthday”, change the last line to "Happy " & Year ( target ) - Year ( Birthday ) & ". Birthday etc."
March 7, 201411 yr Here's another way to look at it: Let ( [ today = Get ( CurrentDate ) ; birthday = Date ( Month ( Birthdate ) ; Day ( Birthdate) ; Year ( today ) ) ; nextBirthday = Date ( Month ( Birthdate ) ; Day ( Birthdate) ; Year ( today ) + ( today > birthday ) ) ] ; Case ( nextBirthday < today + 10 ; "Happy Birthday" ) ) See also: http://fmforums.com/forum/topic/48048-birthday-reminder-how-can-i-do-it/ Edited March 7, 201411 yr by comment
March 7, 201411 yr Author Here's another way to look at it: Let ( [ today = Get ( CurrentDate ) ; birthday = Date ( Month ( Birthdate ) ; Day ( Birthdate) ; Year ( today ) ) ; nextBirthday = Date ( Month ( Birthdate ) ; Day ( Birthdate) ; Year ( today ) + ( today > birthday ) ) ] ; Case ( nextBirthday < today + 10 ; "Happy Birthday" ) ) See also: http://fmforums.com/forum/topic/48048-birthday-reminder-how-can-i-do-it/ Thank you so much all. The above worked amazingly. Thank you so much. I just now need to try and understand and learn how it was put together for futire reference. I'm loving learning filemaker.
Create an account or sign in to comment