Option Set Filtering (Again)

I am working on a dashboard that helps businesses manage events. The application has a dashboard with a repeating group that has a data source

Search for Events (database table)

Events Table has a value called “type” for the type of event (e.g. Live Webinar, Recorded Webinar, Public Workshop, etc). That data comes from an Option Set cleverly named Event Types.

I added a drop down over the dashboard set up as follows:
Choice of style: Dynamic Choices
Type of Choices: Event Type (an Option Set)
Choices Source: All Event Type
Option Caption: Current Option Display

Ta-dah - they are all there.

The workflow is to Set a Custom State on the dashboard that
Does a Search for Events
Conditional
Type (from the Event table) contains This Dropdowns Selected Display is not empty.

When I accept the conditional and go back to the Set State the error is:
“Evaluates to a List of Event Types”

Option Sets are not in the database. But once the Dropdown has a selected option, why would the Search that is constrained by the Dropdowns Selected Display (or value) find anything other than the value from the Dropdown?

I am assuming the value stored in the Events table for type (Option Set Event Type) is an integer or ID. Do I need to expose that and match ID’s?

Have been messing with this for a few days, walk away, ice, JW Black, and it’s still a mystery to me why Option Sets are so difficult to apply as a filter. There are at least 10 queries on the same topic and each one lost me along the way.




Hi there, @chris43… can an event have more than one type? If not, your type field should be Event Type instead of List of Event Types (which I’m guessing you know you can only change by creating a new type field).

If the above is correct, then it should be as simple as having the repeating group’s data source be a search for events with a constraint where type = Select Event Type's value, and you would select the Ignore empty constraints checkbox so all events are returned when nothing is selected in the dropdown.

Any of that make sense? Hope it helps.

Best…
Mike

1 Like

Hey Mike - thanks for the information. There are in fact multiple types of Events but each event can have only one Type. So in order to protect data integrity, we use an option Set for the user to select Event Type and give them a preset of options.

Otherwise, yes, I would just have the type column in the database as text making this exercise MUCH easier. But knowing how well I type, I am guessing users will type worse and we will have Live Webinars and Love Webinars which I believe are two VERY different things. :slight_smile:

I wasn’t suggesting that the type field be a text field… I would definitely be using an option set, too. I believe the trouble you are having is related to the type field being a list instead of a single Event Type (that is, still tied to the option set but not a list).

I see what you are saying - let me try that and see if that solves the issue. Thanks!

1 Like

I gave up on the type and am working on Name. I ditched some of the Option Sets in part because most of the data coming into this app are coming through an API where the type will already be set.

Still swirling around… the data structure looks like this:

Registrants - people who have registered for an event (maybe more than one) (registrant_id)
Event - an event or series of events that people register for (webinar_id)
Registrations - a list of registrants who have registered for the events. (webinar_id, registrant_id)

The filter is a drop down Select using the Event Name to pick up the people who registerred for the event. My background is database marketing so the SQL looks like:

Select A.*
from Registrants as A, Registrations as b, drop down as C
where A.registrant_id=B.registrant_id and B.webinar_id=C.drop down value.webinar_id

The problem is that the drop down value has the event NAME and not the webinar_id. In Bubble, I cannot get to the webinar_id connected to the drop down Event Name filter and don’t want to use the ID in the filter because no one knows what that is. I would add a Search bar but the page is about taking actions on Registrants for different events and the event name on the list is not needed. Not sure if this helps or not… thanks for looking it over. The terms Bubble uses for “is in” and “do a search for” are colliding with Select * from… that is ingrained in my head.