Skip to main content
Question

Check to see if a value in one list, is contained in another list

  • September 10, 2020
  • 0 replies
  • 53 views

Forum|alt.badge.img+14
How would I search through one list and see if any of those values are contained in another list?

Then return it as a formula checkbox, or formula text, the output doesn't matter I can deal with that. Just not how to approach this.

------------------------------
Mike Tamoush
------------------------------

MarkShnierYou
Forum|alt.badge.img+22
  • Quickbase Alumni
  • September 10, 2020
so two field son the same record.

like

cats;dogs;parrots

and the other list is
fish;hamster;cats

so that would be TRUE because they both contain cats?


------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------

MarkShnierYou
Forum|alt.badge.img+22
  • Quickbase Alumni
  • September 12, 2020
Mike
Here is an example using Multi select fields for the input and output. The result will be a multi select apparance with the unique values.

var text ListOne = ToText(
    );
    var text ListTwo = ToText(
      );

      var text A = Trim(Part($ListOne,1,";"));
      var text B = Trim(Part($ListOne,2,";"));
      var text C = Trim(Part($ListOne,3,";"));
      var text D = Trim(Part($ListOne,4,";"));
      var text E = Trim(Part($ListOne,5,";"));


      Split(List(";",
      If(Contains($ListTwo,$A), $A),
      If(Contains($ListTwo,$B), $B),
      If(Contains($ListTwo,$C), $C),
      If(Contains($ListTwo,$D), $D),
      If(Contains($ListTwo,$E), $E)))


      .........

       and here is the count of the # of common terms

      var text String = ToText(
        );

        Count(
        Trim(Part($String,1, ";"))<>"",
        Trim(Part($String,2, ";"))<>"",
        Trim(Part($String,3, ";"))<>"",
        Trim(Part($String,4, ";"))<>"",
        Trim(Part($String,5, ";"))<>"")

        ​

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------