eddiedredge Posted March 7, 2014 Posted March 7, 2014 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)
liltbrockie Posted March 7, 2014 Posted March 7, 2014 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?
eddiedredge Posted March 7, 2014 Author Posted March 7, 2014 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.
liltbrockie Posted March 7, 2014 Posted March 7, 2014 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!
eos Posted March 7, 2014 Posted March 7, 2014 If ( Birthday ≥ Get ( CurrentDate ) and Birthday ≤ Get ( CurrentDate ) +10 ; "Happy Birthday"; "") I doubt that Birthday will be ≥ the current date …
liltbrockie Posted March 7, 2014 Posted March 7, 2014 I doubt that Birthday will be ≥ the current date … lol I'm an idiot...
comment Posted March 7, 2014 Posted March 7, 2014 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.
comment Posted March 7, 2014 Posted March 7, 2014 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. 1
liltbrockie Posted March 7, 2014 Posted March 7, 2014 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 :-(
eos Posted March 7, 2014 Posted March 7, 2014 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."
comment Posted March 7, 2014 Posted March 7, 2014 (edited) 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, 2014 by comment 2
eddiedredge Posted March 7, 2014 Author Posted March 7, 2014 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.
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