2 Replies Latest reply on Mar 12, 2011 9:08 AM by KevinPfeiffer

    Clearing and Detecting Variable Repetitions



      Clearing and Detecting Variable Repetitions


      I have a few questions.


      1) Is is possible to count the number of repetitions of a variable or global variable using a function?


      2) is there a way to clear a (global) variable's repetitions easily?


      I don't currently know of a way for 1.


      For 2, I usually make a script and loop:

      set variable $c = 1

      set variable $$var[$c] = ""

      set variable $c = $c + 1

      Exit Loop If $c > 100


      But this is annoying. There should be some unsetVariable script step or something...



        • 1. Re: Clearing and Detecting Variable Repetitions

          I don't think so. The term "repetitions" is somewhat misleading when applied to a variable. There is no connection between repetitions of the "same" variable - each repetition is a variable on its own. Basically, the repetition number is just another element of a variable's name.


          Note also that a variable can have non-continuous repetitions, e.g. $var[1} and $var[356], with nothing in-between.

          • 2. Re: Clearing and Detecting Variable Repetitions

            There is this script step/function (notice the nice feature of being able to clear a range.):*

            Clear Variable

            Clear Variable [ <variable name> {[<repetition number>{..<repetition number>}]} ]
            Click Specify to set the variable options:
            Name is the name of the variable you want to clear.  Prefix the name with $ for a local variable or $$ for a global variable. If no  prefix is added, $ is automatically added to the beginning of the  name.
            Repetition is the repetition (index) number of the  variable you want to create. If no repetition is specified, the default is  1; range is optional.

            * Unfortunately it does not exist (at least not in Filemaker 11). But there's the brute-force method: close the file and re-open... :-(

            -K (not a pro, just a user)