Brian Dunning's FileMaker Custom Functions

text.before ( _text ; _searchString ; _occurrence ; _include.b )

extracts text before search string

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

Fabrice Nordmann   Fabrice Nordmann

Share on Facebook Share on Twitter

  Sample input:
Before ("" ; "@" ; 1 )
Before ("aa:bb:cc" ; ":" ; -1 )
Before ("a¶b¶" ; ¶ ; -1)
  Sample output:



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

extracts the beginning of a text, based on a search string and an occurrence number
occurrence can be positive (starting from the beginning of the text) or negative (starting from the end)

see also text.after, text.between, and text.betweenNext functions



Ed Schussler   Ed Schussler, East Hanover, NJ
Sep 26, 2010
The function and narative describe four variables, yet the sample input and ouput section shows only three variables used.
Three variable, four variables, whichever, I can not get any result with this custom function other that that designated as the "searchString". Why?
Olly   Olly, London
Sep 29, 2010
Oops... meant


use 0 in 4th param, should work as expected.

believe 4th param gives option to include/exclude the 2nd param in result.


Before ("" ; "@" ; 1; 0 )
= jim

Before (""; "@" ; 1; 1)
= jim@
Warren   Warren, Bostom
Dec 10, 2012
Thanks. This is helpful. How can script be modified to select text, starting from left, of a string up to the first “(”, when there are multiple “(” 's in the text? eg

typical field:
Actinomycin (Dactinomycin, Antibiotic)(Control Peptide)

result required:

Log in to post comments.


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

Under construction. Email me your wish list for improvements.