Variable Greater Than Variable...?

Hi There Soupers! I hope you can help... I'm going around in a circle.

I have a script that collects a set of data by User input on a Filemaker UI screen. These are held in variables and those are then entered as a Record in another table.

Within this script, there is a Loop function. I create $count=0 and then Set $count=$count+n' everytime I loop successfully. I use 'Exit Loop IF = $count>=$total' to jump out of the loop and exit the script.

It doesn't work. And I have little hair left to pull. In the Data Viewer, I watch $total sit at '12', then $count goes '6', then '12' then '18' etc. through to about 72 then drops out of the loop and exits.


If $total is '6', I can set 'n' to 1 through 6 and it exits, but the moment it goes over, it just runs through about 7 records then exits. I don't know what I'm doing wrong.

I built a global field to hold the total in, to run a variable comparison against and get a similar result.

Can anyone help me please?

Thank you!

Here's a screengrab of the code i wrote.

When you get an input from a custom dialog the input will be stored as text. When you are testing the value of $total you use GetAsNumber( $total ) to ensure that it does a number comparison and not a text comparison.

and welcome to the Soup!



Text / Number! That's why '=' works, but greater than and less than don't!!! Crikey crikey.

I'll run some testing; THANK YOU, Malcolm! Have a great weekend!


You are always better served by a greater than or equal to in these loops. That is because of your found count comes out as zero, and your increment value is 1 or greater, the loop will never end as the equal will never evaluate as true.

1 Like