How to count occurrences for each values in an array?

@mikec here is a JavaScript option that I alluded to earlier in the thread:

let arr = p1.split(/,\s?/);
return arr.filter(x => x === p2).length;

Note:

  • this is done in the Tags table, not in the Brands table. It’s much easier to do it this way.
  • a regular expression is used in the split. This handles the case where there is a space after the comma in the joined list.