8 Replies Latest reply on Mar 27, 2012 12:44 PM by RyanCourville

    Due Date Count Down

    RyanCourville

      Title

      Due Date Count Down

      Post

      Hey

      I am working on a Calibration Database and I want to have it automatically tell me when its 30 days before calibration is due. I used the get ( current date) - cal due and put it into datecalulated. Then made a script to find where datecalulated is <= 30 days. I dont know how to get it to incremement though. Like today it would say 30 days and then tomo would say 29 etc etc.

      Also would there be a way to set it to automatically run the script as soon as filemaker opens to help elimate human error cause right now I have it has a button.

      Thanks

       

      Ryan

        • 1. Re: Due Date Count Down
          philmodjunk

          cal due would appear to be a field of type date that is storing the date on which the calibration should be performed.

          cal due - get ( current date)

          Should then calculate the number of days until the calibration should be performed. If it is set in storage options to be an unstored calculation, this field will update each day to count down the days.

          I don't know if you are tracking calibration dates for multiple items or just one. I will assume multiple items that you want a warning message to appear if any of the equipment records show a cal due date that is 30 days or less in the future from today's date:

          Go to layout [specify layout for equipment records]
          Enter Find Mode []
          Set field [equipment::cal due ; "<" & Get ( Currentdate ) + 30 ]
          Set Error capture [on]
          Perform find []
          If [Get ( FoundCount ) ]
             Show Custom Dialog ["These items need calibration within the next 30 days..."]
          End If

          In file options, you can specify that this script be run each time the file is opened.

          • 2. Re: Due Date Count Down
            RyanCourville

            Thanks for you help :D but now I got another issue lol, once I changed the field that is called calculateddate which is the value of cal due - get ( currentdate) to an unstored calc the scirpt stopped pulling up the records that need calibration and shows all of them.

            I got it the script working before I changed it to a unstored value.

             

            Thanks again for you help.

             

            Ryan

            • 3. Re: Due Date Count Down
              philmodjunk

              My script only references the original field: cal due and this doesn't refer to Get ( currentDate ).

              • 4. Re: Due Date Count Down
                RyanCourville

                Ahhh hmm I wonder why the script stopped working once I changed it to a unstored value?

                 

                There are no references its just a stand alone DB. With 1 table. Ill look into it though.

                 

                Thanks again for you help.

                 

                Ryan

                • 5. Re: Due Date Count Down
                  philmodjunk

                  Does cal due refer to this field in its calculation?

                  Is it a field of type calculation or a date field with an auto-enter calculation?

                  • 6. Re: Due Date Count Down
                    RyanCourville

                    Caldue is a drop down calender.

                     

                    calculateddate = caldue - get ( currentdate)

                     

                    calculateddate is a calculation field and is an unstored calculation.

                     

                    I uploaded a picture of the script, maybe you can check to see if there are any errors that would explain why it isnt working anymore.

                     

                    Thanks again,

                     

                    Ryan

                    • 7. Re: Due Date Count Down
                      philmodjunk

                      The set field step has a problem. It should look like this:

                      Set Field [Calibrations::cal Due; "<" & Get ( currentdate ) + 30 ]

                      You can't copy and paste this expression from your web browser into the specify calculation dialog as I used underline formatting to produce the <

                      operator.

                      • 8. Re: Due Date Count Down
                        RyanCourville

                        Got it!!!!!!!!!

                         

                        OMG....

                         

                        <</span> instead of <=

                         

                        *facepalm lol been looking at it too long lol

                         

                        Thanks again for you help!!!!!

                         

                        Ryan