6 Replies Latest reply on Dec 31, 2013 10:00 PM by PrisonProfessor

    Calendar Reminder

    PrisonProfessor

      Title

      Calendar Reminder

      Post

           I'm looking to create calendar reminders for different fields in different tables.
            
           I'm thinking it will take several scripts that basically preform the same function but act on the different fields
            
           One example of a reminder is to remind me of a person's wedding anniversary
            
           Here is the script
            
           Set Field [ ProfileInvestmentPartners::_cWeddingDate; Month ( Get ( CurrentDate ) ) & " / " & Year ( Get ( CurrentDate ) ) ]
           Set Error Capture [ On ]
           Perform Find [ ]
           If [ Get ( FoundCount ) ]
           Show Custom Dialog [ Title: "Wedding"; Message: ProfileInvestmentPartners::_pkPIPId & " " & ProfileInvestmentPartners
               PIP_1stPartnerFirstName & " " & ProfileInvestmentPartners::PIP_2ndPartnerFirstName & " " & ProfileInvestmentPartners
               PIP_LastName; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
           End If
            
           CWeddingDate is calculated with the below statement 
            
           Date ( Month ( PIP_WeddingDate ) ; Day ( PIP_WeddingDate ) ; Year ( Get ( CurrentDate ) ))
            
           However I'm not getting results expected; I get results when in the layout associated with that table; I'd like it to execute when I start Filmaker. When I do execute manually it works only in the layout mode associated with table and it give me dialog on the active record regardless of PIP_WeddingDate. I like to have it display all if an PIP_WeddingDate with in 5 days of current date.
            
           I hope that is enough info. I myself am slowly learning Filemaker PRO Advance but I'm still raw so detail is very helpful
            
           Thanks
            

        • 1. Re: Calendar Reminder
          philmodjunk
               

                    I get results when in the layout associated with that table;

               That is a necessary requirement for a find to work in FileMaker. It must be performed from a valid table occurrence context for the table being searched and this is determined by what layout is current at the time the find is performed.

               If you have multiple dates in multiple tables, you can simplify your process by putting all such dates in one table and using relationships to link those date records to specific records in your other tables. This can allow you to put all such "significant dates' in a single table and then you need only perform finds on that table to find all such dates for a given time period whether they be birthday, anniversary or other dates of significance.

          • 2. Re: Calendar Reminder
            PrisonProfessor

                 It never gets easy for long. Instead of going long will give 1 example

                 Table  = RelationDateReminders::_fkPIP_Id <--> HistoryInmateIncarceration::_pkHII_Id

                 Field = DateReminders::cHII_DateofParole

                 Configuration = Date,  Auto-enter calculation replaces existing vale; evaluate always

                 Calculation = cHII_DateofParole = Date ( Month ( HistoryInmateIncarceration::HII_DateOfParole ) ; Day ( HistoryInmateIncarceration::HII_DateOfParole ) ; Year ( Get ( CurrentDate ) ) )

                 Script =

                 Enter Browse Mode
                 Set Field [ DateReminders::cHII_DateofParole; Month ( Get ( CurrentDate ) ) & " / " & Year ( Get ( CurrentDate ) ) ]
                 Set Error Capture [ On ]
                 Perform Find [ ]
                 If [ Get ( FoundCount ) ]
                   Show Custom Dialog [ Title: "Parole"; Message: ProfileSoldiers::_pkSP_Id & " " & ProfileSoldiers::PS_FirstName & " " &
                   ProfileSoldiers::PS_LastName; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                 End If
                  
                 Layout = DateReminders
                 w/Fields = DateReminders::cHII_DateofParole, HistoryInmateIncarceration:HII_DateOfParole
                  
                 I edited  HistoryInmateIncarceration:HII_DateOfParole to equal  12/30/2013
                  
                 Results nothing
                  
                  
                 Thanks
                  
            • 3. Re: Calendar Reminder
              philmodjunk

                   This should be reversed:

                   Table  = RelationDateReminders::_fkPIP_Id <--> HistoryInmateIncarceration::_pkHII_Id

                   change to:

                   Table  = RelationDateReminders::_pkPIP_Id <--> HistoryInmateIncarceration::_fkHII_Id

                   In other words, use a unique identifier field in RelationDateReminders to link to a record in HistoryInmateIncarceration.

                   Then in RelationDateReminders, define two fields:

                   EventName, EventDate.

                   Put the date of any significant date, birthday, anniversary, incarceration date, release date, children birthdays into the EventDate field of different records. Put text in EventName to identify the type of event.

                   For calculated dates, use a script with set field to assign the date to the EventDate field.

                   Then your script to find all Parole date events for the current month:

                   Go to Layout [ "RelationDateReminders" (RelationDateReminders) ]
                   Enter Find Mode []
                   Set Field [ RelationDateReminders::EventDate ; Month ( Get ( CurrentDate ) ) & "/" & Year ( Get ( CurrentDate ) ) ]
                   Set FIeld [ RelationDateReminders::EventName ; "Parole" ]
                   Set Error capture [on]
                   Perform Find []
                   If [ Get ( FoundCount ) //there are parole dates for this month ]

              • 4. Re: Calendar Reminder
                PrisonProfessor
                     I'm just about to give up and stick with Google Calendars but I'm stubborn
                      
                     Perhaps I explained incorrectly which wouldn't surprise anyone
                      
                Anyways Thank you very much and have a safe and Happy New Year Phil
                      
                     I have three tables
                      
                Table 1 & Fields I'm attempting to pull
                      
                     Primary Key = _pkHII_Id
                      
                     HistoryInmateIncarceration::HII_DateofDischarge DATE
                     HistoryInmateIncarceration::HII_DateOfParole DATE
                      
                Table 2 & Fields I'm attempting to pull
                      
                     Primary Key = _pkPIP_Id
                      
                     ProfileInvestmentPartner::PIP_1stPartnerBirthday   DATE
                     ProfileInvestmentPartner::PIP_2ndPartnerBirthday  DATE
                     ProfileInvestmentPartner::PIP_WeddingDate            DATE
                      
                Table 3 & Fields I'm attempting to populate upon find
                      
                     Primary Key = _pkDR_Id no link
                      
                Relationships
                      
                     Key  _fkHII_Id links to HistoryInamteIncarceration::_pkHII_Id
                     Key _fkPIP_Id links to ProfileInvestmentPartners::_pkPIP_Id
                      
                      
                     DateReminders::DR_cdHII_DateofDischarge        
                           DATE Calculated GetField ( HistoryInmateIncarceration::HII_DateOfDischarge ) Auto-enter Calculation replaces existing value execute always
                     DateReminders::DR_cdHII_DateofParole          
                           DATE Calculated GetField ( HistoryInmateIncarceration::HII_DateOfParole ) Auto-enter Calculation replaces existing value execute always
                     DateReminders::DR_cdPIP_1stParnterBirthday
                           DATE Calculated GetField ( ProfileInvestmentPartner::PIP_1stPartnerBirthday ) Auto-enter Calculation replaces existing value execute always
                     DateReminders::DR_cdPIP_2ndParnterBirthday
                           DATE Calculated GetField ( ProfileInvestmentPartner::PIP_1stPartnerBirthday ) Auto-enter Calculation replaces existing value execute alway
                     DateReminders::DR_cdPIP_WeddingDate
                           DATE Calculated GetField ( ProfileInvestmentPartner::PIP_WeddingDate ) Auto-enter Calculation replaces existing value execute always
                      
                      
                Script I’m using to test for Date of Discharge I have one record set to today's date
                      
                     Go to Layout [ “DateReminders” (DateReminders) ]
                     Enter Find Mode [ ]
                     Set Field [ DateReminders::cdHII_DateOfDischarge; Month ( Get ( CurrentDate ) ) & " / " & Year ( Get ( CurrentDate ) ) ]
                     Set Field [ DateReminders::enHII_DateOfDischarge[DateReminders::enHII_DateOfDischarge]; "Discharge" ]
                     Set Error Capture [ On ]
                     Perform Find [ ]
                     If [ Get ( FoundCount ) ]
                     End If
                      
                Script I plan to use once above script is working
                      
                     Go to Layout [ “DateReminders” (DateReminders) ]
                     Enter Find Mode []
                     Set Field [ DateReminders::DR_cdHII_DateOfDischarge; Month ( Get ( CurrentDate ) ) & " / " & Year ( Get ( CurrentDate ) ) ]
                     Set Field [ DateReminders::DR_enHII_DateOfDischarge[DateReminders::DR_enHII_DateOfDischarge]; "Discharge" ]
                     Set Error Capture [ On ]
                     Perform Find [ ]
                     If [ Get ( FoundCount ) ]
                     End If
                     Go to Layout [ “DateReminders” (DateReminders) ]
                     Enter Find Mode []
                     Set Field [ DateReminders::DR_cdHII_DateOfParole; Month ( Get ( CurrentDate ) ) & " / " & Year ( Get ( CurrentDate ) ) ]
                     Set Field [ DateReminders::DR_enHII_DateOfParole[DateReminders::DR_enHII_DateOfDischarge]; "Parole" ]
                     Set Error Capture [ On ]
                     Perform Find [ ]
                     If [ Get ( FoundCount ) ]
                     End If
                     Go to Layout [ “DateReminders” (DateReminders) ]
                     Enter Find Mode []
                     Set Field [ DateReminders::DR_cdPIP_1stPartnerBirthday; Month ( Get ( CurrentDate ) ) & " / " & Year ( Get ( CurrentDate ) ) ]
                     Set Field [ DateReminders::DR_enPIP_1stPartnerBirthday; "Partner 1 Birthday" ]
                     Set Error Capture [ On ]
                     Perform Find [ ]
                     If [ Get ( FoundCount ) ]
                     End If
                     Go to Layout [ “DateReminders” (DateReminders) ]
                     Enter Find Mode []
                     Set Field [ DateReminders::DR_cdPIP_2ndPartnerBirthday; Month ( Get ( CurrentDate ) ) & " / " & Year ( Get ( CurrentDate ) ) ]
                     Set Field [ DateReminders::DR_enPIP_2ndPartnerBirthday; "Partner 2 Birthday" ]
                     Set Error Capture [ On ]
                     Perform Find [ ]
                     If [ Get ( FoundCount ) ]
                     End If
                     Go to Layout [ “DateReminders” (DateReminders) ]
                     Enter Find Mode []
                     Set Field [ DateReminders::DR_cdPIP_WeddingDate; Month ( Get ( CurrentDate ) ) & " / " & Year ( Get ( CurrentDate ) ) ]
                     Set Field [ DateReminders::DR_enPIP_WeddingDate; "Wedding Date" ]
                     Set Error Capture [ On ]
                     Perform Find [ ]
                     If [ Get ( FoundCount ) ]
                     End If
                • 5. Re: Calendar Reminder
                  philmodjunk

                       It looks to me like you are way over complicating this. Please read my last post again. Instead of separate fields in different tables that record these dates, use two fields in a related table of "events". Use one field to label the event and one field to record the date. You can then search this field for any number of different types of events or any number of different time periods--including the search for all parole dates as you described just prior to my previous posted comment here.

                       Your existing tables can link to this "events" table by linking to a primary key field defined in events. This will insure that each such record, even from different tables, links to the correct event record in order to record a Parole date, incarceration date or a birthday.

                       And you shouldn't need to copy any data from any records just to show the information produced by such a search of your events table records.

                       You can event display these dates in a standard calendar that you can display on your screen or print out.

                       You may find this demo file of interest: https://www.dropbox.com/s/e8d03xvwe8vtz85/Calendar.fp7

                       You can open it from the File menu to produce a copy converted to the .fmp12 file format if you are using FileMaker 12 or newer.

                  • 6. Re: Calendar Reminder
                    PrisonProfessor

                         I was able to get this solution  of your's to work. That Calendar.fmp looks interesting though. Do I dare try? cheeky Thanks & HNY Phil 

                          

                         Say you have a date field in your contacts table labled "date of birth". You can then define an unstored calculation field, cBirthday, as:

                         date ( Month ( date of birth ) ; day ( Date of birth ) ; Year ( Get ( currentdate ) )

                         You can set up a script that performs a find like this:

                         Enter find mode [] //clear the pause check box
                         Set Field [Contacts::cBirthday ; Month ( Get ( CurrentDate ) ) & "/" & Year ( Get ( CurrentDate ) )]
                         Set Error Capture [on]
                         Perform Find []
                         If [ Get ( foundcount ) ]
                            Show custom dialog ["Here are this month's Birthdays"]
                         End If

                         This can be a script that runs each time you open the file. The script can be enhanced so that it only performs the find once a month or the first time you open the file each day if you don't want to see this reminder every time you open the file.