This is a tipical error of numbers interpreted as text. ( Do you know, Phil ? )
If [ GetAsNumber ( $counter ) > GetAsNumber ( $end ) ]
It would be useful to see the actual script so we can spot why the data in the variables is treated as text instead of numbers.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
- If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
Though, as I said, I'm not really in the same place as I was a few months ago to be posting images, scripts, pdf's and what not (time constraints), I will say that variable declaration in scripts clearly states "Calculation must be text" at the bottom (Guess I missed that before).
Of course there are many ways around this, but it just strikes me as a little off. Seems like the type for the calculation results could be specified here, as it is when creating a field calculation. Not big deal I guess.
Usually, if the calculation computes a numeric value, the value stored is a number and when compared to other values in a boolean expression such as those found in your Exit Loop If script step, it will evaluate as a number. But if the calculation is set up (by the operators, functions and literal values used) to compute a text value, the value will be stored and evaluated as text.
Set Variable [ $K ; value: $K + 1 ]
produces a numeric result that is stored as a number.
Set Variable [ $K ; value: "Apple " & "Computer" ]
produces a text result that is stored as text.
Set Variable [$K ; Value: "12" ]
produces a text result that is stored and evaluated as text due to the quotation marks used.
This is why I asked to see your script as this would help us spot what expression is producing a text result that "types" the variable as text rather than a number..
Also, Raybaudi recalled in another post that it seemed like variables were always text in an older version so if you are using a version older than FileMaker 11, that might also be a factor here.
Thanks Phil and Ray.
The issue was indeed that some of the numeric fields referenced in the calculation that determined the variable were defined as 'text' and not 'number.'