Forum Academy Marketplace Showcase Pricing Features

Filter based on Custom state, list to list "AND" "OR" using Calendar Element (not a RG))

Hello bubble community,

I would like to ask the community for help. I have had a read through the following threads:


These articles helped me to understand the limitations of “do a search for” with constraints and :filter → advanced: “intersect with”, “contains” etc.

I am able to make the filtering work the way I want but there is a limitation of RG that I can use only 4 conditionals. I need 7 conditionals. I was hoping you could give your opinion and help me in solving the following case:

I have a Calendar Element from jared.gibb:

I have the following filter parameters:

  1. Event Type[Single text on Event]: Class or Party
  2. LocationText[Single text on Event]: Hamburg, Berlin, Bremen, Hannover
  3. Typedance[List of texts on Event]: Bachata, Salsa on1, Salsa on2, Salsa Cubana, Zouk, Kizomba

Then I have created an Event Object in the DB. Event can have only 1 Location and 1 Event Type but can have multiple dance styles.

Example data:

What I have found reading all the threads is that custom events are the way to go with multiple constraints, but I have not found a thorough solution of how to do it. On top of that I am not sure if the custom events is the way to go if we are filtering via non-repeating group element like this calendar. (Although I think under the hood it is still an RG).

Anyway, what I am looking for is:

Default value on load: All events (so parties and classes) which LocationText is Hamburg.

Then in the interface, using filters the user should be able to:

a) Type dance → show ANY events that match either bachata or salsa on1 or salsa on2
AND (if user selected Berlin as location)
b) Show only results in Berlin that match 1.
AND (if user selected Hannover)
c) Show only results in Berlin, Hannover that match 1.
AND (if user selected Party)
d) Show only results in Berlin, Hannover that match 1 and are Parties (no classes please)

But I would also need:
a) (if user selected ONLY Berlin as location)
Show all results in Berlin that are parties and classes and with all dance styles.
a) (if user selected only Party as event type)
Show all Parties results that are in Hamburg, Berlin, Hannover, Beremen… and with all dance styles.

First, to test the filtering logic I am indeed using RG’s. But then I would like to move that to the calendar once it is working. In total I would need 7 conditionals but the RG is allowing me to add only 4 conditionals!!! Is this a bug?!

What is already working is:

  1. Find any events where Location Text is inside of the Custom State (Location-List-Options).

Next two screenshots are showing that if I select Hamburg and then select Berlin, any events matching these criteria will show on the RG.

  1. Find any events where EventType is inside of the Custom State (EventType-List-Options).

  2. Then Filtering List of things using intersect with.
    Do a search for Events:filtered -> Advanced: Find any events where index'sCustomState (DanceStyles-List-Options)'Display intersects with This Events's Typedance:count>0

Events’s Typedance is a comma separated list of text (see example data). This also works and displays any event that matches any of the typedace such as bachata, salsa on1, salsa on2.

The issue starts when I want to combine 1 AND 2, 1 AND 3, 2 AND 3, 1 AND 2 AND 3 because there is not enough conditional statements available on the group. So I guess the custom event solution is the only option here. :thinking:

What would be the custom event solution to this filter romanmg is suggesting? Will that work for this calendar element as well?

Please have a look into the app. I have created a RG that tries to combine the search filters. Seeing it live might help you understand the issue better.

Thanks you your help. :slight_smile:

The restriction to only be able to use 4 conditionals in RG is a bug I think. I just found one of the threads where user ccabaj used 5 conditionals

It was a bug. I had to update bubble to the newest version to fix the problem.

When I upgraded the bubble version and refreshed the app. I could add 7 conditions. Here is the solution using repeating group and using conditionals.

This screenshots shows conditions for when user selects only 1 option from the group (either EventType or TypeDance or Location).

Then we have conditions when user selects options from 2 groups (EventType + Location, EventType + TypeDance, Location + TypeDance).

And the last one when the user selects options from all 3 groups (Location + EventType + TypeDance)

Next screenshots show how to filter for these events using the appropriate method, “is in” for constrains when using single text value on Event Object or “intersect with” using in :filter → advanced when searching for matching values between 2 lists.

I also removed the default Data Source. You do not need it if you want to render the list empty initially.

As for the Custom Event solution, you need to create a Custom Event using the filtering shown in the screenshots above. But for the Custom Event, from what I tested so far you need a button that “triggers a custom event”. There is a hook like this in the workflows.

When a button is clicked → trigger a custom event → in the custom event you have the filters. I created just one filter when user selects options from all 3 groups. So you would need to create next steps in the workflow for when user uses 2 groups and just 1 group.

As a thought but you can get the filtering to work in an RG, why not use the RG as the calendar data source?!

Not sure how would that work Jared :see_no_evil: :sweat_smile:

For your calendar plugin I just added 7 conditionals and copied the expressions for each: title, start time, end time, event ID, event identifier id.

Here are the screenshots: