Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 3971 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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)

 

Posted

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?

Posted

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. 

Posted

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!

Posted

If ( Birthday ≥ Get ( CurrentDate ) and Birthday  ≤  Get ( CurrentDate ) +10 ; "Happy Birthday"; "")

 

I doubt that Birthday will be ≥ the current date …

Posted
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.

Posted

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.

  • Like 1
Posted

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 :-(

Posted

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."
Posted (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 by comment
  • Like 2
Posted

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. 

This topic is 3971 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.