8 Replies Latest reply on Mar 26, 2012 12:44 PM by user14040

    Can a Custom Dialogue Box Be triggered on a certain date

    user14040

      Title

      Can a Custom Dialogue Box Be triggered on a certain date

      Post

      Hi

      I have 3 questions

      1. I am trying to figure out how to trigger a custom dialogue box when a date is reached but I dont want to trigger a hundred pop ups if a hundred records as the same trigger date

      Example:  Date reached: 6/30/2012  Message: PM's are Due please check PM Due Layout for List of upcoming PM's

       

      2. Is it possible to launch a script on the desktop from FilemakerGo, I have a Back up button that I want to be able to click on and it will back up the solution on the desktop.  I do have a timer script that works find but I also need to back up manually if needed.

       

      3. Is their a way that I can add a button to the solution that will pop up a message asking where to save the backup solution. (Desktop Only)

       

      How or where can I get information on how to do the above question.  I am just learning scripting so any help would be appreciated.

      Thanks

       

        • 1. Re: Can a Custom Dialogue Box Be triggered on a certain date
          user14040

          Thought I had my thinking hat on this one,

           

          Script

           

          If[Equipment::DateFlag="CONTRACT WILL EXPIRE SOON"]

          Perform Script["Contract Expired Dialogue Popup"]

          Else

          Exit Script[]

          End If

           

          Loaded the script on layout load and nothing happed.  I really thought I had a brainstorm.  Any Ideals?

           

          Thanks

          • 2. Re: Can a Custom Dialogue Box Be triggered on a certain date
            philmodjunk

            Not sure what your table structure is here.

            1)

            Were you on a layout that refers to Equipment in layout setup | Show records from?

            How would Equipment::DateFlag get the value "Contract will expire soon"?

            What was the value of Equipment::DateFlag for the current record?

            You can set up a script that checks a date in your database against Get ( CurrentDate ) and have it display a message when the dates are equal. You can use File Options to specify that this script run each time the file is opened. But the details in how you'd store such a date and how you'd check will depend on the design of your database.

            2)

            Not really. You can, however set a value in a record from the FileMaker Go client and a script that starts up and checks for this value on regular intervals can then do the save a record as to save a back up copy. There are several ways a script on the desktop machine can run with intervals--Install OnTimer being one option, a robot FileMaker file is another.

            Note that with FileMaker Server hosting your files, backups can be scheduled to take place at regular intervals.

            3)

            If you are performing the script on a machine hosting the database with FileMaker Pro, the Savea Copy as script can be used with options that pop up such a dialog where you can specify both name and location for the back up copy.

            • 3. Re: Can a Custom Dialogue Box Be triggered on a certain date
              user14040

              Hi 

               

              1.

              No the layout I was using was the main Interface layout not associated with the equipment table.

               

              Equipment::DateFlag is a text box with the following calculation

              If(GetAsNumber(Contract_Renewed) > 15 and Get ( CurrentDate ) >= Contract_Renewed ;"CONTRACT WILL  EXPIRE SOON")

              When a date is reached Contract will Expire soon will be displayed in the Equipment::DateFlag [text field]

              Using Condition Formatting the box turns red when the words are entered in the field.

               

              Instead of date I thinking using the words maybe a better approach if I can figure out the script to use.

               

              2. OK, thanks

               

              3. Great Thanks

              • 4. Re: Can a Custom Dialogue Box Be triggered on a certain date
                philmodjunk

                What exactly do you need to check? Do you have multiple records with a Contract Renewed date?

                (Note almost any date you enter will have GetAsNumber(Contract_Renewed) > 15 evaluate as true as date fields record the number days from the date you see in the field to the date 12/31/0000. I doubt this is how you wanted this to evaluate.)

                I'm guessing you have multiple equipment records and you want to know if any of them have a contract due date that are 0 to 15 days in the future of the current date. I could be guessing wrong however.

                Go to layout [Equipment//find must be performed on a layout based on the equipment table]
                Enter find mode[] // clear the pause check box
                Set field [Equipment::Contract_Renewed ; "<" & Get ( CurrentDate ) + 15 ]
                Set error capture [on]
                Perform find[]
                If [Get ( FoundCount ) ]
                   Show custom dialog ["The equipment shown will come due for contract renewel in the next 15 days."]
                End If

                This script will also find all equipment for which the renewel date has expired (is now in the past) as well. A more sophisticated search criteria can be used that omits such records if you don't want them found.

                I wouldn't perform a find on a calculation field like you have as such fields must be defined as unstored calcualtion fields or they won't update with the passage of time. Performing finds with criteria specified for unstored fields will be much less efficient than performing a find with criteria specified in the renewal date field that should be stored and indexed.

                • 5. Re: Can a Custom Dialogue Box Be triggered on a certain date
                  user14040

                  That script worked perfectly but is their a way to exite the script if the foundset equals 0.  I made a little changes to the following

                   

                  Set field [Equipment::Contract_Renewed ; "<" & Get ( CurrentDate ) + Equipment::Term ]
                  Set error capture [on]
                  Perform find[]
                  If [Get ( FoundCount ) ]
                     Show custom dialog ["The equipment shown will come due for contract renewel in the next 15 days."]

                   

                  I set the number of days in the Term [field] which changes the FlagDate(Contract_Renewal)

                   

                  Everything works great but what to do when it does not find any records can it exit the script?  

                   

                  Thanks

                  • 6. Re: Can a Custom Dialogue Box Be triggered on a certain date
                    user14040

                    I think I got it 

                    I added a Else if Statment

                     

                    Else if [Get (FoundCount)=0]

                    Show all Records

                     

                    I it looks like it worked got to do more testing but thanks so much for your help.

                    • 7. Re: Can a Custom Dialogue Box Be triggered on a certain date
                      philmodjunk

                      I doubt that it works perfectly.

                      In find mode Equipment::Term will be empty (Unless it is a global field) and thus your script is really using this criteria to perform the find:

                      Set field [Equipment::Contract_Renewed ; "<" & Get ( CurrentDate ) ]

                      If the term is different for each equipment item, then you'll need to use a calculation field to compute the due date:

                      Define "Date Due" as

                      Contract_Renewed + Term

                      and specify "date" as the return type.

                      Then you can use:

                      Set field [Equipment::Date Due ; "<" & Get ( CurrentDate ) ]

                      My original example could be modified to be:

                      Go to layout [Equipment//find must be performed on a layout based on the equipment table]
                      Enter find mode[] // clear the pause check box
                      Set field [Equipment::Date Due ; "
                      <" & Get ( CurrentDate ) ]
                      Set error capture [on]
                      Perform find[]
                      If [Get ( FoundCount ) ]
                         Show custom dialog ["The equipment shown will come due for contract renewel in the next 15 days."]
                      Else
                         #you can also put other script steps here that change layouts, perform finds etc. before exiting the script.
                         Exit Script
                      End If

                      Exit script is not needed in this example unless you intend to add more script steps below the End IF step.

                      • 8. Re: Can a Custom Dialogue Box Be triggered on a certain date
                        user14040

                        Thank You I think its working find now I will do some testing to make sure, thanks for your help.