AnsweredAssumed Answered

Inequalities with local variables in Exit Loop Statements

Question asked by nihmbrisby on Sep 15, 2014
Latest reply on Sep 19, 2014 by nihmbrisby


Inequalities with local variables in Exit Loop Statements


One weird and persistent problem I've had over months of development is as follows:

I define local variables (ie $counter = 1 and $end=10) in the beginning of the script.  I set up a loop.  I increment the counter (ie $counter = $counter +1).  I create an exit loop if () statement.  The statment is simply $counter>$end.  

This consistently exits the loop when the counter is less than end.  I stare at the data viewer till my eyes bleed:



Exit Loop if ($counter>$end)

And every time- the loop is exited when $counter = 2 (that is to say, the loop repeats once).  If I do *nothing* more than change ">" to "=" the script works perfectly.  I get the same problem with greater than or equals to.

I'm close enough to the finish line that I just don't have the stamina to investigate this further.  Nevertheless, I just wanted to throw this out there to see if anyone had any ideas.  My only idea is that filemaker may be treating local variables as text, not numbers.

At the moment I simply do not use inequalities in control statements.