Filter Repeating Group Based on 4 Check Boxes

Filter

I have a repeating group and within that group their is a field called Order Status.

I want to be able to have the user filter Order Status their orders by having check boxes checked or not checked.

I can’t seem to be able to find any information on YouTube or the forums about this. Can anyone please explain a solution?

Thank you!

1 Like

Hi @dropshiptyler1 - here’s one solution for this which uses Custom States.

Step 1- Data Structure
I created a Data Type called “Orders” which has two Data Fields, “Order Name” (text) and "Order Type (text)

Step 2 - Custom State
I created a Custom State called “Order Status” (text) which has “List” checked off. Reason being is “Order Status” will keep track of each checkbox status for the N-number checkboxes (4 in your case).
image

Step 3 - Add Checkboxes
I didn’t do anything fancy with the Checkboxes. Note that once I had once Checkbox setup and working, I did a copy/paste with workflows to save some time.
image

Step 4 - Add Workflows
Each Checkbox will have two Workflows, one for when Checkbox is checked and one for when it’s Unchecked. Just remember to change the value of “Value” for each Checkbox Workflow. For instance in the images below, the Value is “Order Status 1” for Checkbox 1. For Checkbox 2, Value would be “Order Status 2” and so on.
Here’s Workflow for when Checkbox is Checked
image

image

Here’s Workflow for when Checkbox is not Checked
image

image

Step 5 - Add Repeating Group with Filter
For the Repeating Group I just did an “open” search (ie no constraints) for all “Orders”
image

Here’s the filter which just looks to see if the Order Status for an particular Order is in the “test’s Order Status” Custom State.
image

Hope this helps and is enough info to get you going.

tx
Nikolai

2 Likes

Hi @dropshiptyler1 - I created a video on my YouTube Channel showing how to implement this.

Using Checkboxes to Filter Repeating Group

Hi @nikolai, thank you for the detailed explanation. I was wondering if I could get your help with some issues given my app’s situation?

Here’s the link to editor of my example app https://bubble.io/page?name=index&id=kbforum&tab=tabs-1 H
Here’s the page https://kbforum.bubbleapps.io/version-test?debug_mode=true

I would like to be able to filter the Repeating Group of Materials on the right based on which Projects and Subcontractors are selected on the left. Also, the list of Subcontractors would be filtered based on which Projects are selected.

Issue #1 - Custom State not capturing list of projects correctly
The Project list is within a group called Project which has a Custom State called “ProjectList”. I tried to set up workflows similar to your explanation so that when I check a Project, it gets added to the “ProjectList”. But, when I check a project it adds all three projects to the custom state. How do I get it to just add the project I checked? My workflow seems to remove the project correctly.

Issue #2 - The Materials Repeating Group doesn’t filter
The Materials repeating group on the right is set up so that the Data Source is filtered based on “ProjectList’s” list of projects. But, it doesn’t appear to be working. When the page loads I do not have any projects checked so I would expect the material list to not be blank.

Issue #3 - How to filter the Subcontractor list based on which projects are selected above
I’m stumped on how to do this. You’ll see that I tried to add a filter based on ProjectList’s list but it’s not working. Any ideas? Again, I should only be able to see the subcontractors that are associated to the projects that are checked above.

I’m wondering, once I have Issue #3 figured out, I should create a “Filter List” button which would run workflows to filter the Material list instead of relying on the check box functions.

Thanks!

Hi @bakercito - I have a second how-to video on filtering that should help you out.

Check it out here.

You’re on the right path putting the checklist values in the Custom States.

For your filtering in the Searches, you’ll want to use “Advanced” which is at the bottom of the list of options

The best solution for you is to use conditionals in the rg. Since you have 4 checkboxes you will have 2^4 conditionals. where is (yes/no) checkbox value and 4 is number of checkboxes . The conditionals would be all possible combinations between them, for exaample Yes,Yes,Yes,Yes or Yes, No, Yes,Yes. And so in the conditional you modify datasource and apply the results depending on the value of the checkbox. Say completed is checked, do search for things where completed is Yes and so on

This seems to make some sense but what if you have 30 different filters against the type?

For the sake of continuing this particular discussion, what if you have filters for:

Order Status = list of text statuses…
Delivery Country = list of countries
and
1 item in the order? = yes/no
2 item in the order? yes/no

And the user selects multiple check boxes / filters not just one filter?

Also when they un-check the filter, it should go back to default again and call all of the info in the list.