Software Venture Consulting
ToMarket

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

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


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

BetweenNext ( _text ; _searchString1 ; _occurrence1 ; _include1_boolean ; _searchString2 ; _occurrence2 ; _include2_boolean )_

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 3.9  (17 votes)
  Discuss this Custom Function

Fabrice Nordmann, 1-more-thing
http://www.1-more-thing.com

extracts the middle of a text in between delimiters, based on search strings and an occurrence numbers

Sample Input:
BetweenNext ( "A 1234567890 X B 1234567890 X C 1234567890 X" ; "B" ; 1 ; 1 ; "X" ; 1 ; 0 )
Sample Output:
"B 1234567890 "


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

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

/*
BetweenNext ( _text ; _searchString1 ; _occurrence1 ; _include1_boolean ; _searchString2 ; _occurrence2 ; _include2_boolean )

by Fabrice Nordmann
v.1.5, Jan 2009
bug fix with short searchString
optimisation
v.1.1.1, Apr 2008
bug fix : if string2 was in string1, result would be erroneous
v.1.1, Feb 2008
returns empty if searchString1 is not found
v.1, Mar 2007

extracts the middle of a text in between delimiters, based on a search strings and an occurrence numbers
occurrences can be positive (starting from the beginning of the text) or negative (starting from the end)
The second string will be found only after the first one.
Both string can be included or excluded with boolean parameters.

e.g : BetweenNext ( "A 1234567890 X B 1234567890 X C 1234567890 X" ; "B" ; 1 ; 1 ; "X" ; 1 ; 0 )
= "B 1234567890 "

see also Between, Before and After functions
*/
Let ([
_occurrence1 = Case ( _occurrence1 = 0 ; 1 ; _occurrence1 )
; _occurrence2 = Case ( _occurrence2 = 0 ; 1 ; _occurrence2 )
; _lenStr1 = Length ( _searchString1 )
; _p1= Position ( _text ; _searchString1 ; Case ( _occurrence1 < 0 ; Length ( _text ) ; 1 ) ; _occurrence1 )
; _rightText = Replace ( _text ; 1 ; _p1 + _lenStr1 - 1 ; "" )
; _p2= Position ( _rightText ; _searchString2 ; Case ( _occurrence2 < 0 ; Length ( _rightText ) ; 1 ) ; _occurrence2 )
; _content = Left ( _rightText ; _p2 - 1 )

]
;
Case ( _p1 and _p2
; Case ( _include1_boolean ; _searchString1 ) & _content & Case ( _include2_boolean ; _searchString2 )
)
)

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

This is my Custom Function and I want to edit it

Discuss:

This code works beautifully.

Carl Riedel, Croydon, UK
July 10, 2011 11:12am

superbly written. incredible useful.

Harald Koeppen, Frankfurt Germany
November 06, 2011 1:57pm

Wouldn't it be great to have a "BetweenPrevious" function as well?

Tobias Sjögren, Stockholm
January 24, 2012 2:36am

BetweenPrevious is included in the "Pro" pack available on our web store (no, just kidding ;))
Please feel free to modify this function and share it!
Fabrice Nordmann

Fabrice, Brussels
January 24, 2012 2:43am

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

Your Name:
City/Location:
Comment:
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 3 + 4 =
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. phpArrayValue ( array ; key ; pos )
  (Fri, Jan 27, 1:49pm)
2. solfm_timeToMinutes (theTime;roundSec)
  (Fri, Jan 20, 6:26am)
3. filterLines(filterField;filterValue;Result)
  (Sat, Jan 14, 2:20pm)
4. getMaxValue ( theList )
  (Thu, Jan 12, 1:06pm)
5. MiddleWordsIncPunct ( text ; startingWord ; numberOfWords )
  (Sat, Jan 07, 9:16am)
6. WindowInfo
  (Fri, Jan 06, 12:39pm)
7. CenterWindow in Window vert horiz (demension)
  (Fri, Jan 06, 12:25pm)
8. UTF8_to_TXT ( Text , Platform )
  (Wed, Dec 28, 10:44pm)

RSS Feed of Custom Functions