Brian Dunning's FileMaker Custom Functions

ReplaceInListƒ ( _list, _originalText, _replacementText )

Replace all instances of a value in a list.

  Average rating: 4.3 (31 votes) Log in to vote

Michael Rhodes   Michael Rhodes
Allied Data Service

Share on Facebook Share on Twitter

  Sample input:
ReplaceInListƒ ( "a¶b¶c¶d¶b¶", "b", "e" )
  Sample output:

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

Replaces all instances of a text parameter in an array with another text parameter.



bbb   bbb, melbourne australia
Mar 13, 2009
Last value should be return delimited also.

Let (
[ array = ¶ & array & ¶
; array = Substitute ( array; ¶ & originalText & ¶; ¶ & replacementText & ¶)
; Middle ( array; 2, Length ( array ) - 2 )
Michael Rhodes   Michael Rhodes, Rancho Cucamonga, CA
Mar 18, 2009

Removed quotes around return characters. However, your use of the Middle function is wrong. Since an array is considered to be a value list, adding a character return to the end only serves a purpose if the value list is somehow missing the end return character. If the intent of your rewrite is to correct such an error, then removing the added end return character in the Let result defeats the purpose.

I have updated the defining of array to properly account for such an error.
Michael Rhodes   Michael Rhodes, Rancho Cucamonga, CA
Mar 18, 2009
Also updated function to replace all instances of found text, not just the first.

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 16 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: