1 Reply Latest reply on Dec 27, 2010 11:07 AM by philmodjunk

    Incrementing a loop counter

    yaldir

      Summary

      Incrementing a loop counter

      Product

      FileMaker Pro

      Version

      11

      Operating system version

      windows

      Description of the issue

      I Have a simple script to auto add portal records.  I have a variale to increment based on a DBfield holds a duration.
      I can create the first record fine, then I use Set Field to increment the variable within my loop.  I am using Set Field
      where my variable is $Seq and the formula is ($seq = $seq + 1)
      Regardles of what I do, it does not increment the $seq value and not sure what else to do.I am using Set variable initially. I can add the first row fine. I then suppose to add a 1 to $seq and use it to position to the next portal recird so on..

      Steps to reproduce the problem

      Set Field [$seq = $Seq + 1]

      Expected result

      never changes, always 1. Calculation is not taken place inside the loop

        • 1. Re: Incrementing a loop counter
          philmodjunk

          To change the value of a variable such as $seq, use Set Variable. Use set Field to change the value of a field.

          Using a variable as your counter:

          Set Variable [ $seq ; Value: $Seq + 1 ] // note the change in syntax.


          If you use a field as your counter:

          Set Field [YourTable::YourField ; YourTable::YourField + 1]