1 2 Previous Next 21 Replies Latest reply on Jan 21, 2011 11:46 AM by philmodjunk

    Birthday display in a horizontal way.



      Birthday display in a horizontal way.


      It is for my contact file. All people have their names and DOB's in database. For the birthdays, in order to save the screen space, I want to have it like this:

      Today's birthdays: John Thompson, Peter Alford, Cynthia Singleton.

      It would be a lot easier task to have them displayed vertically, but this order is preference here.

      How can it be done?

        • 1. Re: Birthday display in a horizontal way.

          The key question is how do you know which people have a birthday today? If it is via a relationship, you can use a calculation field with subsitute and list funcitons to get your horizontal list:

          Subsitute ( List ( TodaysBirthdays::Name ) ; ¶ ; ", " )

          • 2. Re: Birthday display in a horizontal way.

            Thanks for your answer, Phil, you are helpful as always.

            You might as well know the best way to get today's birthdays. Can you tell it here? I'm sure it will be useful for more people than just me.

            • 3. Re: Birthday display in a horizontal way.

              This thread reminded me that I needed to query a Children's Ministry database to get a list of upcoming birthdays Wink

              Here's the calc I use:

              Date (Month (Birthdate) ; Day (Birthdate) ; Year (Get ( CurrentDate ) ) )

              You can just use a script to peform a find for all records where cBirthday holds today's date.

              This won't work with the relationship I suggested, but the script can loop through the records and build your list of names separated by commas pretty easily. (Can't use the above calculation on the "many" side of a relationship as it must remain an unstored calculation.)

              • 4. Re: Birthday display in a horizontal way.

                What I tried to do, but failed...

                I. In my Contacts table, I created 6 fields:

                1) DOB_month [calculation(result - Date): Month (dob)]

                2) DOB_day [calculation(result - Date): Day (dob)

                3) DOB_next_day [calculation(result - Date): Day (dob) +1]

                4) cur_date_month [calculation(result - Date): Month (Get (CurrentDate))]

                5) cur_date_day [calculation(result - Date): Day (Get (CurrentDate))]

                6) cur_date_next_day [calculation(result - Date): Day (Get (CurrentDate)) +1]

                II. Then I created 3 table occurences based on Contacts table and related them accordingly:

                1) Contacts::DOB_month = Contacts_dob_day::cur_date_month

                     Contacts::DOB_day = Contacts_dob_cur_date_date

                2) Contacts::DOB_month = Contacts_dob_next_day::cur_date_month

                    Contacts::DOB_next_day = Contacts_dob_next_day::cur_date_next_day

                3) Contacts::DOB_month = Contacts_dob_month::cur_date_Month

                III. I created 3 portals to display:

                1) today's birthdays

                2) tomorrow's birthdays

                3) this month's birthdays.

                The problem is - all portals are empty and relationship doesn't seem to work. How do I solve this issue? Strangely enough, when i put all 6 calculations of previously mentioned fields in Data Viewer - they work like charm. But relationship somehow doesn't work.

                • 5. Re: Birthday display in a horizontal way.

                  The problem is that the "current date" based calculations cannot be stored and indexed. If you reverse your relationships it should work:

                  Contacts::cur_date_month = Contacts_dob_day::DOB_month AND
                  Contacts::cur_date_day = Contacts_dob_day::DOB_day

                  Contacts::cur_date_month = Contacts_dob_next_day::DOB_month AND
                  Contacts::cur_date_next_day = Contacts_dob_next_day::DOB_next_day

                  Contacts::cur_date_Month = Contacts_dob_month::DOB_month

                  That way, from a layout based on Contacts, you will be able to see the related records from the Contacts_dob_ relationships.

                  This is a key detail to understand about the fields used in relationships. Unstored or global fields may be used from the Parent or "One" side of the relationship to access Child or "many" records, but you cannot start from the "many" or child side and access the parent record.

                  Note: text in red refers to a different field and table occurrence name than you posted in your last post.

                  • 6. Re: Birthday display in a horizontal way.

                    I placed relationships as you said. Today's birthdays work. Tomorrow's - don't, today's birthdays are displayed instead of tomorrows.

                    Month's birthday's work.

                    I now need to get week's birthday's to work too. Any ideas?

                    • 7. Re: Birthday display in a horizontal way.

                      I don't see any mistakes in how you've defined the calculations. Make sure the ones that use Get ( CurrentDate ) are unstored. Check the values of all four fields to make sure that they are calculating the correct values.

                      The problem with using birthday dates as a foreign key:

                      Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( Get ( CurrentDate ) ) )

                      Works nicely to compute the date and WeekofYear ( Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( Get ( CurrentDate ) ) ) )

                      Will return the week in which the year falls. There's also a calculation for returning the date of the nearest preceding Sunday for a date that can be used which better handles weeks that start in one year and end in the next.

                      None of this works for the "many" side of our relationship, however, due to the fact that all of these calculations must be unstored in order to update correctly.

                      Here's best I can come up with for Birthdays on the same week:

                      If you define an auto-enter date field with this calculation: Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( Get ( CurrentDate ) ) )

                      The field will show the correct date for the first year in which it was created.

                      If you then use a script that updates this field for all contacts at the start of each new year, this stored, indexed field can be used in place of the above unstored Birthday date calculation field and now you can get relationships to work.

                      The script can use show all records on a contacts layout and then use Replace Field Contacts to recalculate the birthday dates for the new year.

                      Birthday - DayofWeek(Birthday) + 1 Will return the date of the immediately preceding Sunday, just to give you a clue.

                      Oh yes, and it just occurred to me that January Birthdays would need to be updated in December or some birthday dates for tommorow or this week, would not appear.

                      • 8. Re: Birthday display in a horizontal way.

                        What I did with week:

                        1) Contacts::week_low [Date ( Month(CONTACTS::dob) ; Day(CONTACTS::dob) ; Year (734411) ) - DayOfWeek (Date ( Month(CONTACTS::dob) ; Day(CONTACTS::dob) ; Year (734411) )) +1]

                        // 73411 is 2011 year, that would be replaced at the end of the year with a script.

                        2) Contacts::week_high_cur [Get(CurrentDate)]

                        And then: Contacts::week_high_cur >= Contacts::week_low

                        Works like a charm!

                        I double checked, all those CurrentDate calculations are unstorred.

                        Still, tomorrow birthdays are not displayed, today's birthdays are displayed in tomorrow's. Any ideas with tomorrow's correction?

                        • 9. Re: Birthday display in a horizontal way.

                          Spotted two issues just now.

                          The day and month calculations don't make sense as "date" return types since they just return a number. I'd make them of type number.

                          The next day calcualtions need a change:

                          Day (dob) +1
                          Day (Get (CurrentDate)) +1

                          Should be:

                          Day (dob+1)
                          Day (Get (CurrentDate + 1))

                          That makes sure you don't get a number like "32"

                          You'll also need a "month next day" calculation: Month ( Dob + 1) as the next day could be the first day of the next month.

                          I don't see how any of these will produce the exact issues you are seeing however. They just fix issues that occur when the birthday  or current date falls on the last day of the month.

                          • 10. Re: Birthday display in a horizontal way.

                            I have no idea. I use

                            CONTACTS::cur_date_plus1 [Day (Get (CurrentDate)+1)] = CONTACTS_dob_next::DOB_plus 1 [Day (dob+1)]

                            And it still displays today's birthday's. That's weird. It seems that Filemaker just doesn't recognize those values, because, whenever i tried to put CONTACTS::cur_date_plus1 > CONTACTS_dob_next::DOB_day (i.e. birthday date), Portal goes blank and no records are shown.

                            And about month next day - how do i place it in relationships?

                            • 11. Re: Birthday display in a horizontal way.

                              about month next day - how do i place it in relationships?

                              Use it in place of Contacts::cur_date_month in the next day's birthday relationship.

                              From what you describe, something is not set up correctly, but I can't see it from here.

                              • 12. Re: Birthday display in a horizontal way.

                                1) Tomorrow thing works. I still don't quite understand how to set up month_next_day in order for it to appear correctly.

                                2) More about that birthdays display in a horizontal way:

                                I have this formula in Data Viewer:

                                Substitute ( List ( CONTACTS_dob_month::nf ) ; ¶ ; " (" & Left(CONTACTS_dob_month::weekday_dob;3) & "), " )

                                It returns list of names like a charm. However, I am trying to set up it like this:

                                Today's birthdays: John Thompson (Thu), Peter Alford (Fri), Cynthia Singleton (Sat).

                                And this is where my edit of this formula goes wrong, because it only displays weekday abbreviation of the very first contact, so, in this case, it would (Thu) for all matching contacts.

                                Any ideas to solve it?

                                • 13. Re: Birthday display in a horizontal way.

                                  For today's birthdays, wouldn't these all be the same day of the week?

                                  Perhaps you meant this month's birthdays?

                                  You'd need to combine name and day of week as a calculation field and then use the list function to "list" this calculation field:

                                  Subsitute ( List ( Contacts_dob_month::cName_WeekDay ) ; ¶ ; ", " )

                                  • 14. Re: Birthday display in a horizontal way.

                                    Thank you very much, Phil.

                                    In my 11 years in various forums, you are the most helpful person ever. You are changing my point of view about internet communities.

                                    1 2 Previous Next