RemoveCommonValues ( Array ; ComparisonArray )
Filter array by comparison array to remove the common values
Average rating: 4.6 (31 votes) Log in to vote
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Function removes the values an array has in common with a second array. I found I needed this function to check that two fields used as a multikey for a relationship (first field in equijoin, second field in a non-equijoin) are mutually exclusive.
|Erik Jutzi, Germany
Mar 13, 2010
very good function, just searched for this functionality to subtract lists from each other to get an exclusive list.
I jut want to say, that I removed the "& ¶" after leftValues(Array;1) in the 5th line. This creates no empty lines in the result list
|Vincent Robinson, San Francisco
Sep 7, 2012
As Erik notes, very useful. To be precise, I notice it returns the left-hand complement. That is, if you run
RemoveCommonValues ("1¶2¶3"; "2¶3¶4")
the return value is "1" (not, "1¶4").
This is fine -- just means you have to run it twice, with the arrays in reverse order, to get the complete complementary set. Doing so, and concatenating with FilterValues on the same pair of arrays gives you the index of the combined arrays -- nice! Needless to say, this could itself be written as a custom function.
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.