Brian Dunning's FileMaker Custom Functions

FindInListƒ ( _list ; _value )

Get the value number of a value in a list

  Average rating: 3.9 (40 votes) Log in to vote

Michael Rhodes   Michael Rhodes
Allied Data
http://allieddataservice.com

Share on Facebook Share on Twitter

  Sample input:
FindInListƒ( "a¶b¶c¶d¶e¶" , "d" )
  Sample output:
4

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

Determines the number of the array value that matches the value parameter.

 

Comments

bbb   bbb, melbourne australia
Mar 13, 2009
Quotes around return character are not required. Need a return at the end of the array.

Let (
[ array = ¶ & array & ¶ ]
; valuecount ( Left (
array
; Position ( array; ¶ & value & ¶; 1; 1 )
) )
)
 
Michael Rhodes   Michael Rhodes, Rancho Cucamonga, CA
Mar 18, 2009
bbb,

Thank you. Did not know quotes were not required around return character, although that does not affect functionality. Custom function works; corrected sample data.
 
Michael Rhodes   Michael Rhodes, Rancho Cucamonga, CA
Mar 18, 2009
An array is assumed to be a value list. A return character added to the end is not necessary unless to account for an error if the array is malformed. Passing a value as the second parameter instead of text circumvents this error handling, however.
 
Ben   Ben, realseeds
Jan 23, 2017
Great custom function.

I tried the following scenario:

Let (
[
array = "30300¶303¶408" ;
value = "303"
];
cfFindInList ( array ; value )
)

Result:2

Another scenario:

Let (
[
array = "30300¶303¶408" ;
value = "30"
];
cfFindInList ( array ; value )
)

Result:0

Correct result, ´cause the ( exact ) value 30 is NOT part of the array.

The custom functions returns a value greater than 0 only if the exact value is in the array.
This is exactly what this custom function does.

Awesome. Thanks to the developer.
 
Ben   Ben, realseeds
Jan 23, 2017
In my program I add the prefix "cf" to all custom functions.
 
Michael Rhodes   Michael Rhodes, Colorado Springs, USA
Mar 17, 2017
Thanks, Ben. I have been using Æ’ to denote custom functions for the last couple years.
 

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