Repeating Fields and Variables - Behavior and Limitations

This script [FM Weetbicks] Best of 2021 #5 - Idle Record Release - #3 by xochi got me interested in the behavior of repeating fields or variables in FileMaker.

Here's a test script - before looking at the results shown below, can you predict what the answer will be?

 $blank = "";
 $x[-2] = "negative 2";
 $x[-1] = "negative 1";
 $x[0] = "zero";
 $x[$blank] = "blank";
 $x[1] = "one";
 $x[1.2] = "onePointTwo";
 $x[100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000] = "alpha";
 $x[100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001] = "beta"
"$x[-2] = " & $x[-2] & ¶ &
"$x[-1] = " & $x[-1] & ¶ &
"$x[0] = " & $x[0] & ¶ &
"$x[$blank] = " & $x[""] & ¶ &
"$x[1.2] = " & $x[1.2] & ¶ &
"$x[1] = " & $x[1] & ¶ &
"$x[100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000] = " & $x[100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000] & ¶ &
"$x[100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001] = " & $x[100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001]

Questions I had:

  • can the repetition number be zero or negative or a decimal?
  • can the repetition number be a string?
  • is there a limit to the # of digits?

Here's what I found:

$x[-2] = negative 2
$x[-1] = negative 1
$x[0] = zero
$x[$blank] = onePointTwo
$x[1.2] = onePointTwo
$x[1] = onePointTwo
$x[100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000] = alpha
$x[100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001] = beta

The answers appear to be:

  • repetitions can be zero or negative
  • decimal repetations are rounded to the nearest integer
  • a non-numeric value (such as "") is interpreted as one, e.g. $variable[1]
  • the repetition number can be more than 50 digits long. If there is a limit, I didn't hit it.

Thanks for this, @xochi .

I tried the following in the data viewer, and reached a couple of conclusions which have nuanced differences compared to what is above.

Above was using:

  • FMPA 18.03.317

  • MacOS 10.13.2

Thanks to @FileKraft for the reminder to include version info.


that's interesting! Wish I could find the documentation about how long the var index is allowed. In the current help for 19.4.2 I can't find any specs.
May I also suggest to disclose always the OS and FM version used when exploring?


(Maybe someone has a link to official documentation about Tech specs?)

1 Like

Excellent point! Especially in my case, as I was using an older machine at the time. I'll update my post above.


Historically in previous versions FM did say a limit on repetitions was something like 32567 (or thereabouts I can't remember the exact number). That was repetitions in a field but I don't know about variables.

We use this technique to hash something like text, to correlate to a repetition in a variable so we can store information (in this case about a window) and retrieve it again.

I don't know what FileMaker is doing under the hood with the very large repetition numbers to be honest, but we've never had an issue using this technique.

Possibly 32768, which is two to the power of fifteen ( sixteen minus one )?