Brian Dunning's FileMaker Custom Functions

SetRepeatingVariable ( variableName ; valueName ; startIndex ; endIndex )

Sets a range of variable repetitions to a specified value

  Average rating: 4.5 (29 votes) Log in to vote

Kevin Frank   Kevin Frank
Kevin Frank & Associates

Share on Facebook Share on Twitter

  Sample input:
SetRepeatingVariable ( "$$test" ; "green" ; 1 ; 3 )
  Sample output:
"green" in reps 1, 2, and 3 of $$test

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

I do a lot of charting using variable arrays, and frequently I need a placeholder value, such as the word "null", in any array rep that doesn't contain data. I used to populate these placeholder reps using a scripted loop, but with this CF, a single line of code is all it takes.



John Leyman   John Leyman, Loma Linda, CA
Nov 28, 2011
Beautiful! An easy way to reset a global variable.
Bruce Robertson   Bruce Robertson
Dec 4, 2011
Fatal flaw; always hits recursion limit.

Original example file posted elsewhere works fine but this part of expression does not match the original.

endIndex = 0 and startIndex = endIndex

In original file it was:

endIndex ≥ 0 and startIndex ≥ endIndex
Kevin Frank   Kevin Frank, Arcata, CA
Dec 4, 2011
Thanks Bruce. Code has now been updated.

It must have gotten munged when I pasted it in to submit it here, because as you point out, it was correct in the original version.

This time around I'm using ">=" so am optimistic that the problem has been solved.

bob   bob
Dec 8, 2011
So If I

SetRepeatingVariable ( "$$test" ; "MyField" ; 3 ; 1 )

It would put the contents of MyField in Rep 3 (only) of the $$test variable?
Kevin Frank   Kevin Frank, Arcata, CA
Dec 8, 2011
Not exactly... first off, if you only want to set rep 3, then you want "3 ; 3" as the final two arguments... because the starting and ending reps are both 3. The point is to specify a range of reps.

Next, since you've wrapped "MyField" in quotes, it will be treated as a text string, so you would end up with "MyField" in $$test[3], assuming you started with

SetRepeatingVariable ( "$$test" ; "MyField" ; 3 ; 3 )

Hope this helps,

Log in to post comments.


Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:

Under construction. Email me your wish list for improvements.