Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages

Shopping Cart
Shopping Cart


Free Newsletter


Privacy Policy

FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.


 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

joinRepeatingVariableFast ( variableName ; delimiter ; startIndex ; endIndex )

Rate this function:  

  Average rating: 4.3  (29 votes)
  Discuss this Custom Function

Sam Barnum, 360Works

Join / concatenate a large repeating variable / array using a delimiter character

Sample Input:
$$foo[1] = "FOO"
$$foo[2] = "BAR"
$$foo[3] = "BAZ"
joinRepeatingVariable("$$foo" ; ", " ; "1" ; "3")
Sample Output:

 Then copy & paste into FileMaker Advanced's Edit Custom Function window.


Uses a recursive "divide and conquer" approach to concatenating a large array of values, yielding better performance than simply iterating over the array appending each item to a large string.

Unlike the version at, this focuses primarily on performance, and does not stop when it reaches the end of the array (all parameters are required).

There is a commented line which clears out the array contents as they are appended, saving memory at a small speed penalty.

The performance increase is achieved by avoiding creating/appending to very large strings. Instead, most of the concatenation operations happen on smaller strings, the smaller bits being built into larger strings at the end.

Benchmarks from a 10,000 repetition variable, each entry 100 characters long:

* Looping append Script, simple: 13,505ms
* joinRepeatingVariable Recursive Concatenation CF: 6,904ms
* joinRepeatingVariableFast CF with clearing array: 2,960ms
* joinRepeatingVariableFast CS without clearing array: 2,330ms
* Looping "divide and conquer" script: 1,930ms

For 20,000 repetitions:
* Looping append Script, simple: 79,026ms
* joinRepeatingVariable Recursive Concatenation CF: ? (too many recursions)
* joinRepeatingVariableFast CF with clearing array: 5,960ms
* joinRepeatingVariableFast CS without clearing array: 4,626ms
* Looping "divide and conquer" script: 3,979ms

For 40,000 repetitions
* Looping append Script, simple: 523,167ms
* joinRepeatingVariable Recursive Concatenation CF: ? (too many recursions)
* joinRepeatingVariableFast CF with clearing array: ? (too many recursions)
* joinRepeatingVariableFast CS without clearing array: (too many recursions)
* Looping "divide and conquer" script: 8,228ms

Note that these techniques fall apart once the arrays get too large, because of the stack limit. You would want to switch to a scripted approach to get around this, but use a similar mechanism where you concatenate the smallest strings first, then join them into larger and larger batches.

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

This is my Custom Function and I want to edit it


Are you sure you're function is faster than the one you reference? Have you tested it and demonstrated it? Can you post a demo file somewhere? As far as I can tell, both algorithms have to perform the same O(N) string concatenations, and they even ultimately do those concatenations in the same order. Am I missing something?

Jeremy, NC
November 19, 2012 12:11pm

Thanks Jeremy, I posted some benchmarks. During testing, I hit the "max stack" issue with FileMaker custom functions. I'd recommend writing a looping script if this becomes an issue.

Sam Barnum, San Francisco
November 20, 2012 12:11am

Doesn't work as written (won't compile successfully in custom function editor). Example doesn't make sense. It calls a function JoinArray which is undefined. Example contains no index values. An example file would really be helpful because it is hard to tell what this is supposed to do.

Bruce Robertson, Redmond
November 21, 2012 4:01pm

Thanks Bruce, I had changed the name of the function, but forgot to update the recursive calls in the function itself

Sam Barnum, San Francisco
November 21, 2012 4:40pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 0 + 8 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
2. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
3. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
4. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
5. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
6. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
7. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
8. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)

RSS Feed of Custom Functions