4 Replies Latest reply on May 10, 2010 7:45 AM by aammondd

    keep track of one script use in a record

    AAgraphics

      Title

      keep track of one script use in a record

      Post

      Using FMP 10 on PC and Mac.

       

      Is there a way to keep track of the number of times a specific script is used in one record?  I have a script that sends an email when you click on the button but I want to keep track of the number of times this button/script have been used in that record.  Any thoughts?  Thank you for your time and help.

        • 1. Re: keep track of one script use in a record
          raybaudi

          Use an $$ variable, something like:

           

          Set Variable [ $$count ; $$count + 1 ]

           

          The count will restart each DB opening.

          • 2. Re: keep track of one script use in a record
            AAgraphics

            A couple of quick questions:

             

            Where do I place the "Set Variable [$$count; $$count + 1]" ?  Does it go in the script?  And how does this information get saved into a field for the record?

             

            Thank you for your help.

            • 3. Re: keep track of one script use in a record
              raybaudi

              AAgraphics wrote:

               

              Where do I place the "Set Variable [$$count; $$count + 1]" ?  Does it go in the script?


              Yes.


              AAgraphics wrote:

               

              And how does this information get saved into a field for the record?

               


              May be that it it better for you to create a global field (gCount) and then the script:

               

              Set Field [gCount; gCount + 1]"

               


              • 4. Re: keep track of one script use in a record
                aammondd

                If you dont want it reset or you want to track the users that execute it you could keep the value in an actual table by storing it via a DB close script

                 

                Im sure by doing this kind of thing you could also stop the script from generating email based on the count 

                By storing the data in an actual table you could also restrict the generation based on date and or user as well.

                 

                All you need to do is store some information in some global fields then relate the tracking table to the global fields

                I use whole tables of global fields for things like this. (Be sure to create one record in the global table because it wont work right otherwise. It can be blank it just has to be there. Cant tell you the amount of frustration that Ive had when Ive forgotten to create the record)