Brian Dunning's FileMaker Custom Functions

ListLogic ( type ; ListA ; ListB )

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

  Average rating: 5.0 (2 votes) 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 */

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

AB
GH /* XOR: 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

Ibrahim Bittar Torres   Ibrahim Bittar Torres, Eikonsys, S.A. de C.V.
Aug 27, 2020
Hi Menno.

It works very well and fast. I'm using in conjunction with ExecuteSQL and it's faster than making a complex query.

Thank you very much,

Ibrahim
 

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 20 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: