The FileMaker Position Function

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit or other formatting of the posting may fail. For the best experience, please visit the journal directly by clicking (here).

Position( text ; searchString ; start ; occurrence)
FMP Version: All recent versions of FileMaker
This function returns the position of a specified string of text within a search string. You can define the text string you are evaluating, the string you are looking for, what character position in the text string you want to start out and at what occurrence you want to return.

The value returned from the position function will always be a number, even if no matches where found in the search string (returned result is 0 not empty).

It should be noted that you can even have a negative number for the occurrence. This means you would be looking for a position behind your established starting point. For example, if you wanted to find out where the last position is, you could enter in an outrageous starting number ( like 1,000,000 ) or start at the end of the string by using the Length function for your starting number. Then you could put a -1 in for your occurrence parameter.

EXAMPLE: Position("LeSaux Media Services", "e", 1, 3)
This example would return the number 15. This is because I wanted to find the third e in the text string of "LeSaux Media Services" starting at the 1st character.

=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2007 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.