cf_getElementNo ( SearchString ; ElementList )
Get the line number of sought-after element in a list
Average rating: 4.4 (34 votes) Log in to vote
Klemens Müller - Show more from this author
Klemens Müller http://www.klemenso.de |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Determines the number of first occurenc of the sought-after element in a list of elements
Comments
Oliver Reid Feb 28, 2009 |
||
I believe this will not work if a an earlier list element contains a later one: e.g., firstgamma gamma and you search for 'gamma' |
||
Oliver Reid Feb 28, 2009 |
||
On reflection I suggest this change: fpos = Position( ¶&clist&¶ ; ¶&spos&¶ ; 1 ; 1 ) + Length( spos )+1 ; |
||
John Jackson, Santa Rosa CA USA Aug 22, 2010 |
||
This won't work if SearchString isn't in ElementList in the first place; it will return a value anyways. | ||
John Jackson, Santa Rosa CA USA Aug 22, 2010 |
||
Here's a revised version: Parameters: element_list, search_string Let( [ s_pos = Position ( ¶&element_list&¶ ; ¶&search_string&¶ ; 1 ; 1 ) ; f_pos = s_pos + Length ( search_string ) - 1 ; f_list = Middle ( element_list ; 1 ; f_pos ) ; index = ValueCount ( f_list ) ] ; If ( s_pos ; index ; 0 ) ) |
||
Edward Souza, Sao Paulo, BR Sep 12, 2010 |
||
Hello, all, Well done, Mr. Jackson. Thanks for sharing. :-) |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.