Is there a way for me to use a formula to find out if two arrays have a value in common? Basically, I want to show a button if a user has at least one value in their “role_ids” array that matches one or more values in the page’s “roles” array.
In a way, it’s like the opposite of the “distinct” filter. Rather than remove duplicates, I want to either keep them or result a boolean telling me if there are or are not duplicates.
You can measure the length(merge(array1,array2)) and compare it against the length(distinct(merge(array1,array2)))
If the lengths match, then there are no matches. If they don’t, then an item was removed with distinct, so there must be a match. (assuming the initial arrays don’t include duplicates. If so, run distinct on them first.)
From your second comment, ““key” may not be the same, just the values,” are you just comparing integers or are these roles inside of an object inside of an array?
Either way, I think you should be able to use some combination of filterByKey or map to condense down the objects into your needed array of just integers, and use them in your comparison formula above.