Brian Dunning's FileMaker Custom Functions

ListLogic ( type ; ListA ; ListB )

Compare lists of values with eachother using NOT, AND or XOR criteria

  Be the first to rate this function Log in to vote

Menno van Beek   Menno van Beek - Show more from this author
Van Beek Zakelijke Software
https://www.vbzs.nl

Share on Facebook Share on Twitter

  Sample input:
ListLogic ( "NOT" ; "AB¶CD¶EF" ; "CD¶EF¶GH" ) /*Values in ListA missing in ListB*/
ListLogic ( "AND" ; "AB¶CD¶EF" ; "CD¶EF¶GH" ) /*Values both in ListA and in ListB*/
ListLogic ( "XOR" ; "AB¶CD¶EF" ; "CD¶EF¶GH" ) /*Values exclusive in one or the other*/
  Sample output:
AB /* NOT: Values in ListA missing in ListB */

CF
EF /* AND: Values both in ListA and in ListB */

AB
GH /* NOT: Values exclusive in one or the other */

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

Simple function to compare (value)lists with each other. The function compares The second list to the first list in 3 possible ways:
1) NOT: Values in the first list missing in the second
2) AND: Values that are in both lists
3) XOR: Values that are not in both lists

This function is not case-sensitive and the first found true-value are returned. This applies mainly to the "AND" variety of the function. If both lists contain the value "AB" and the first list has that as "ab" then "ab" will be returned.

Requirement: FileMaker 16+ because of the use of the UniqueValues-function

Only the XOR-variety is recursive, NOT and AND are not.

[edit=2019-05-28]Fix for NOT-type: it returned only 1 line with all values of lista when listb would be empty[/edit]
[edit=2019-05-28]Fix to remove ¶ at the end of the result for XOR-type[/edit]

 

Comments

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.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: