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?

Let(
[
 $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.
4 Likes

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.

3 Likes

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?

Thanks!

(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.

2 Likes

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 )?

The limit on repetitions for repeating fields is 32,000 (not a power of 2 like you would expect).
This document references FileMaker 8, but the limit was still accurate when I last checked a couple years ago.
https://support.claris.com/s/article/Technical-Specifications-of-FileMaker-Pro-8-and-FileMaker-Pro-8-Advanced-1503692922817?language=en_US

That same document also says the maximum number of repetitions for variables is much larger: 10^400
I think that is still true. It allows for obviously very large numbers, which people have used for the “names buckets” technique, where some identifier is hashed to get a numeric address, and the value stored in that repetition of a variable, global or local. Very useful.

5 Likes

And variable repetitions can be signed numbers. Not so for a field repetitions.

Here is the link to the limits on v19. FileMaker Pro 19 Technical Limits.

The maximum number of repetitions is unchanged.

Interesting to see that the length of fields has been reduced significantly.

In v8 the limit is one billion characters per field per repetition (limited by available memory)

In v19 this limit is less than 10 million characters per field per repetition (limited by available memory)

1 Like

If you're using 32,000 repetitions in a field, you got far bigger problems than needing 32,001.

5 Likes

thanks for the link - not sure if the list is correct and definitely incomplete though - recursion limit can be extended with FM18 SetRecursion function which is 'buggy' ..

also still Substitute function with generic argument list is limited to 999 bracketed argument pairs.

how about script results and script parameters and SQL statement length ?? (bottle necks everywhere)