Brian Dunning's FileMaker Custom Functions

ZapValues ( ListA ; ListB )

Removes the items in ListB from ListA.

  Average rating: 4.3 (48 votes) Log in to vote

Ray Cologon   Ray Cologon
NightWing Enterprises
http://www.nightwing.com.au/FileMaker

Share on Facebook Share on Twitter

  Sample input:
ZapValues ( "Dan¶Ron¶Paul¶Jen¶Greg"; "Ron¶Jen" )
  Sample output:
"Dan¶Paul¶Greg¶"

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

The ZapValues function removes from ListA any values which are found in ListB, where ListA and ListB are carriage-return separated text lists.

This provides the logical inverse of FileMaker 7's built-in FilterValues( ) function.

 

Comments

Mark de Haas Meijer   Mark de Haas Meijer, Almere
Apr 6, 2010
Cool function. Thanks!
 
F.Bruckert   F.Bruckert, Tours/France
Jun 15, 2010
Very useful !
I've tried to make it, without success.
Thanks a lot :)
 
Justin Pakes   Justin Pakes, Virginia, USA
Jul 17, 2012
Thank you! I have tried 4 of these functions here to date, and this is the only one that handled properly when value being removed was at start of list twice.

ZapValues ( "a¶a¶b¶c¶a" ; "a" ) does return "b¶c"
!!!

Thanks again.
 
Jon Klassen   Jon Klassen, Alberta, Canada
Aug 12, 2014
Here is the function without a Return at the end, The function name has been changed to 'RemoveVales';

If (
IsEmpty ( ListA ); Let( $repRemoveValues = ""; "");

Let([

value = LeftValues(ListA; IsEmpty(FilterValues(LeftValues(ListA; 1); ListB)));
value_trim= Substitute(value;¶; "");
$repRemoveValues = If( not IsEmpty(value); $repRemoveValues + 1; $repRemoveValues);
cr = If($repRemoveValues > 1 and not IsEmpty(value_trim); ¶; "")];

cr &
value_trim &
RemoveValues(RightValues(ListA; ValueCount(ListA) - 1); ListB)
)
)
 

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.

Under construction. Email me your wish list for improvements.