I often find myself making tables with many groups.
Sometimes I want to implement the ability for visitors to my doc to be able to select specific groups without needing to know how to operate the Filter() function. To allow this I often implement a small selector table. (Here I’m indicating the visitor’s selection with column ‘x’.
This approach is especially useful when I have a complicated Filter running in addition to the Group selector.
You might think that all you have to do is check if the groups you are showing are in the group names you selected.
What you’ll notice if you try this is that it doesn’t work :
This is because the Selector is wrapping the list of group names (“A” and “B”) in another list. This is really tricky to notice, because if you print Selector.x it looks like it’s a list of
If you don’t know this, when you check if Selector.x has “A” in it, it can get very confusing.
This is because a list doesn’t normally have brackets around it. When it does, it’s actually a list with a list inside of it.
This means that if you want to get the list inside of that list, you need to use First() to get the first (and in this case, only) element. Then the Contains() function will work as expected.
Changing the Filter to match fixes the issue; everything shows up!
And now the Selector will work as expected.
The completed table.
If you’d like to access the doc you can request access here