Skip to content

Instantly share code, notes, and snippets.

@dansmith65
Created January 4, 2014 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dansmith65/8249869 to your computer and use it in GitHub Desktop.
Save dansmith65/8249869 to your computer and use it in GitHub Desktop.
FileMaker Custom Function: ListContains ( ValueList ; ValuesToTestExistence )
/* ListContains ( ValueList ; ValuesToTestExistence )
PURPOSE:
Test if all specified values exist in a list.
PARAMETERS:
ValueList (text) values to search in
ValuesToTestExistence (text) value(s) to search for
RETURNS:
(bool) True if ALL values exist in the list
DEPENDENCIES:
none
NOTES:
This function is approx. 25% slower than using a function like this, for a single value:
Not IsEmpty( FilterValues( ValueList ; SingleValue ) )
REVISIONS:
2012-AUG-31 - Created by Dan Smith dansmith65@gmail.com
####################################################################################################*/
Let([
~count = ValueCount( ValuesToTestExistence )
];
If(
~count = 0 ;
False ;
// else
// test first value
If(
IsEmpty( FilterValues(
ValueList ;
GetValue( ValuesToTestExistence ; 1 )
) ) ;
// value not found
False ;
// else
// value found
If(
~count = 1 ;
// this is the last value, and it was found
True ;
// else
// test next value
ListContains(
ValueList ;
RightValues(
ValuesToTestExistence ;
~count - 1
)
)
)
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment