Brian Dunning's FileMaker Custom Functions

NthItem ( text ; delimiter ; itemnumber )

Returns the text item specified from a list of items seperated by specified delimiter

  Average rating: 4.4 (29 votes) Log in to vote

Drew Boone   Drew Boone
Doulos Ministries, Inc.
http://douloscorp.com

Share on Facebook Share on Twitter

  Sample input:
NthItem ("red,white,green,blue";
",";
3)
  Sample output:
green

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

I found this function quite useful when working in REALBasic, so I engineered this solution for FMP. Basically, it will select the specified item in a list. One of its best features is that the user can specify the delimiter for the items in the list. For example. If I only want the 3 byte of an IP address I can specify "." as the delimiter.

 

Comments

Oliver   Oliver, CT
Apr 5, 2015
For NumberOfDelimiters I would use PatternCount rather than your expression.


If one is using a multiple character delimiter e.g."||" it might because a single "|" could occur in text -- in which case your expression would return say 3.5 instead of 3 if text was:


"ab|cd||de||ef||gh"
 

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