The difference between 'includes' and 'is included in'
It's helpful to think about includes and 'is included in' as opposites of each other, just like greater than & less than.
The 'includes' condition looks for the second value in the first value. The 'Is included in' condition looks for the first value in the second value.
How to use the 'is included in' condition
There are many use cases for the 'is included in' condition. Here's one.
In our user profiles table, we have a column called Team. In this column, we have a comma-separated list of values that determine which team an individual is on.
- Jack is only a member of one team
- Mark is a member of two teams
- David is a member of all teams
In our other table, we have three items and each of these have different teams in their Access Level column.
- Item 1 is viewable by anyone in Team 1
- Item 2 is viewable by anyone in Team 2
- Item 3 is viewable by anyone in Team 3
We want people to only see items for their own team. Because David is in all three teams, we want him to be able to see all items, and Jack to see only Item 1.
To do this, we need an 'Is included in' condition.
To only show items that the user has access to, we need to create a filter on our list which shows items where the access level is included in the user's team column.
This condition will look at the three users in the following way:
- Item 1's access level is 'Team 1'. Since this value 'is included in' all user's team column then all users will see it.
- Item 2's access level is 'Team 2'. Since this value 'is included in' Mark & David's team column, they will see it.
- Item 3's access level is 'Team 3'. Since this value 'is included in' only David's team column then only David will see it.
This example was with filtering, but it could also work for visibility conditions, add conditions, delete and edit conditions. Also this example was illustrated with Teams, but you could extend this to anything you like. For example – admin roles: editor, contributor, etc.