Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.