Optimal way to filter repeating group

Hi,

I have a repeating group which is used to display different type of events (Online, InPerson).

I have few filters on top of this RG:
ALL - show all events
ONLINE - show online events
INPERSON - show INPERSON events
FREE - show all free events (include both online and inperson which are free to attend)

Right now, on click of these different buttons, I am changing the data source of the repeating groups to show events accordingly.

Is there a better way to filter these events?

Thanks,
Ram

Do a search with a constraint event_type = element_to_choose_event_type's value and ignore empty constraints checked.

If you are using something like buttons/tags - you can use custom state to store selected value and reference it in your Do a search.

So no need to have multiple conditional data sources (if I understood your setup correctly)

2 Likes

You could try this

1- Add a hidden group somewhere in your app with type of content set to ‘Type of event’

2- When you click one of your filter buttons → populate that group with the relevant type of event (use conditions). Eg: Click online → display data in hidden group ‘Online’

3- Filter the RG with the hidden group now.

This way you don’t have to change the data source of your RG

Let me know if this helps or if you need any more info

1 Like

They still would. Once for each filter or ‘hidden group’ to be the conditions for populating the group with data related to the filter choices. It is simply changing out conditions on the RG for conditions on workflows to set the data.

Best way is to use the search constraints in a do a search as previously suggested by @artemzheg

@tech16 you will want to think about the data structure related to the type of data that is being searched and filter with the filter choices and the way that Bubble search constraints work.

You would want to decide if you will use URL parameters or custom states to hold onto the user selections of filters and whether or not you want the filters to work in tandem with eachother. Obviously, ALL is all so it is not applied against other filters, but a FREE show could be ONLINE or INPERSON. Normally these types of filters would utilize a data field of type yes/no for the determination of is an event ONLINE or INPERSON, however, there are other ways to achieve knowing an event is ONLINE or INPERSON without using multiple yes/no fields, such as an option set of filter choices.

In your situation I would suggest using an option set, which has 4 values, ALL, ONLINE, INPERSON, FREE

On the data type add a field that is related to the Option set and make it a list.

When creating data entries of the type, you will populate the field of the Option set with ALL EVERYTIME, so that ALL events in the database have at least one value in the list field, ALL. Then if the user is creating an ONLINE event and it is FREE you will add those two option values into the database, so the single event will have 3 option values in the data field, ALL, ONLINE and FREE.

Then on your search page, you can have a repeating group for the filters and the data source will be the Option set All options.

Then your choice of url parameter or custom state for holding the selected values.

Then, for your search you Do a Search for events with a filtered operator using an Advanced search of events option field list intersects with selected value list count is selected value list count.

This method does of course use the advanced filter which is not recommended but could be tested against your current implementation to see if there is a comparable difference with one approach more performant than the other.

I personally, do not care at all about taking a few extra steps to add more conditionals to do something like change a datasource if, one it is more performant than other approaches or two is overall a little bit simpler to implement.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.