Code - Custom Function

RemoveCommonValues ( Array ; ComparisonArray )

BrianDunning.com, Brian Dunning http://www.briandunning.com/filemaker-custom-functions/list.php


RemoveCommonValues ( Array ; ComparisonArray )
Rate this function: Average rating: 0.0 (0 votes) Discuss this Custom FunctionBob Kalus, KaluBo
bobearl.org
Filter array by comparison array to remove the common values
==================== SAMPLE INPUT AND OUTPUT ====================
INPUT
RemoveCommonValues ( 1¶2¶3¶4¶5¶6¶7¶;2¶4¶6¶8¶10¶12¶14¶ )
OUTPUT
1¶3¶5¶7
==================== DESCRIPTION ====================
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.
==================== CUSTOM FUNCTION ====================

Case(ValueCount(Array) ≥ 1;

Case(PatternCount(¶ & ComparisonArray & ¶;¶ & LeftValues ( Array ; 1 ));

RemoveCommonValues(RightValues(Array;ValueCount ( Array ) - 1);ComparisonArray);

LeftValues(Array;1) & ¶ & RemoveCommonValues(RightValues(Array;ValueCount ( Array ) - 1);ComparisonArray))

)


Referring URL: 'http://www.briandunning.com/cf/1130'

Attached File:    

Screenshot:    


Keywords: ''

ClipManager: