So, i have a repeating group of users which I’m trying to filter. I have the filter buttons on top of the users table and by pushing these buttons, they do a drop down and you can select multiple filter options, for example, if i push roles, i can select: designer, developer, etc. By doing so I create a list of role filters, which contains the texts of the filters the user chooses.
I know for a fact that the list is there, containing all the filter texts the user chooses, however my problem is the following, I’m trying to use this filter list to filter the repeating group. The repeating group is made of users as i said, and they have a roles table, which basically is a list of roles the user has/is. What I’m trying to accomplish is simple, I want to check if there is at least a single role from the users that is present in the roles filter list, because if there is, i want the user to be displayed, if not, well i don’t want the user to be there. I tried to add a constraint, but i didn’t see any operators which do: “if users user’s roles has at least 1 role text which matches a role from the roles filter”.
Can somebody help me out with this issue?
Thanks <3
So if your User has a field role and you would like to filter the repeating group using a dropdown (single value choosing), all you need is to add constraint role = dropdown's role value in your Do a search expression. If the field role within User is a list of roles - role contains dropdown's role value
Thank you for the reply. I really appreciate the time you’re giving to address my issue.
The thing is, it’s not single value choosing, you can actually choose multiple filters at once, so it’s a list of texts(filters).
I’m using nonsense in my screenshot to show you the structure; replace the things with what you use in the app. This RG data type’s roles intersect with user selected roles list:count is not 0
So you intersect with the selected roles and check if the count is not zero. If it’s not, then include it.
Another way to look at it is:
Item #1 in RG has roles: X, Y
User wants to see all items that are : X or Z
If you intersect those two lists, then X remains. That means the resulting list will have a count of one, which means it will be displayed in your RG.
If your RG data type has one role per thing, then you should be able to use the “is in” search constraint:
If you first select “Filtered” in your main Data Source, in the filter popup you would then select “Advanced”. In using the screenshot from @julian5 example above:
Thank you for the reply <3.
One last question, everything worked fine, except for the fact that when the page loads, nothing is present. The filtering process works as it should because i copied it exactly how Julian had it and i thought count is not 0 would do the trick. I even checked the ignore empty constraints checkbox but for some reason until i filter something, nothing shows up
Hmm certainly an interesting issue! Off the top of my head I assume this is because the constraint is an Advanced Filter with a yes/no condition, and not an input itself. Once you select some filters but then deselect them all, is your repeating group staying populated or does it go blank again?
The repeating group filtering process works exactly as it supposed to, so the answer is, it goes blank, but that’s the problem. By default, when no filters are selected, it shouldn’t be blank
This is my app here, Roles, skills, seniorty and languages filters are working and until you don’t choose all of the filters, the filtered user/s won’t appear. I’m guessing that the filters i’ve added aside from roles work just the same as the roles itself, so it won’t display the users until their filtered, so unless you pick all the above filters mentioned, you won’t get your user/s.
Ok here’s something else to try - have the data source just be ‘Search for Emps’ (no Filter). Have a condition on the Data-Content Repeating Group that when Group M’s ChosenFilters:count is not 0, Data source = Search for Emps: filtered. And then on the Filter add your Advanced filter as written.
There is just one issue
For some reason the filtering doesn’t work unless i choose all of the filters when they should be working both independently and all together.
Here, i have 2 constraints for skills and roles the way you told me, it worked fine for only a single one however for 2, the filtering won’t work unless i choose the filters from both groups: