Brian Dunning's FileMaker Custom Functions

joinRepeatingVariable ( variableName ; delimiter ; startIndex ; endIndex )

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

  Average rating: 3.9 (55 votes) Log in to vote

Sam Barnum   Sam Barnum - Show more from this author
360Works
http://360works.com

Share on Facebook Share on Twitter

  Sample input:
joinRepeatingVariable("$$foo" ; ", " ; "" ; "")
  Sample output:
FOO, BAR, BAZ

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

Join a repeating variable / array with a delimiter, using recursion.

If endIndex is not specified or is negative, the recursion will exit on the first empty element in the array. Otherwise, empty elements will be included in the results until endIndex is reached.

 

Comments

Bruce Robertson   Bruce Robertson
Mar 14, 2011
Also works for repeating fields!
 
Bruce Robertson   Bruce Robertson
Mar 14, 2011
The CF assumes that N for $var[N] is positive. Actually (unlike repeating fields) it can be zero; or negative; though it must always be an integer. In practice I suppose negative or zero values for N are rare.
 
Sam Barnum   Sam Barnum, 360Works
Mar 14, 2011
Interesting point, Bruce. If this function were to support negative indices, the empty-arg approach would require a way to iterate backwards to find the first non-empty value. Currently if no startIndex is specified 1 is assumed.
 
David Walton   David Walton, Wellfleet, MA
Jun 27, 2011
Perfect. Thank you Sam!
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. 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 20 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: