Condensing Multiple Conditions

I have many situations where I have a condition that needs to check one or more options. For example, I have an option set OS-Lists which has the following options:

  1. Inbox
  2. Actions
  3. Projects
  4. Agendas
  5. References
  6. Trash

I could have en element with the following condition:

Screenshot 2023-12-11 at 12.47.09 PM

This example is more simple to set up than many in my app. Sometimes there are 6-10 different options that I need to test for.

Is there a better way to construct this condition? What I’d like to be able to do is something like:

When: Group Test's OS-Lists is in the set {Actions, Inbox, References}

Something like this is much easier to input, but I don’t know how in Bubble to enter a subset of the option set without naming the ones of interest individually. Could I create another option set of the subset? Yes, but I simply have too many varying conditions for this to be feasible or make any sense.

Also, it’s not always just using option sets. I often need a condition to test if the URL is one of several, or the values of a state, etc. It’s very tedious to input all of these individually and sometimes difficult to get the parentheses to align correctly for the result I want causing me to delete and re-enter several options.

I’m open to ideas. Thanks!

What conditions are you looking for and how is data set up in OS-Lists?

Add an attribute to the Option Set and use that to filter the options.
If the option set can be separated into clear partitions (eg. Admin, Vendor & Customer), use these to create another optionset and set it as an attribute to the main option set.

However if you want more flexibility with your subsets you could use a text-type attribute which you could essentially use as an ID. I just call it ‘index’ and set them to 1,2,3,4,5…
The conditional would look like the following:

All Options:filtered > constraint: This option’s index is in Arbitrary Text > ([Put your desired indices here seperated by a comma ] : split by ‘,’ :contains parent’s group option

Its not a ridiculous timesaver, but it does make it easier to add/remove options from the conditions, as you just need to modify the list of numbers in the Arbitrary Text

1 Like

Group Test's OS-Lists is in Actions:converted to list:plus item Inbox:plus item References

In this, :plus item = OR and the only extra operator required is :converted to list

2 Likes

The only problem with this solution is that if you have to remove one of the options from the middle of the dynamic expression it becomes a nightmare and bubble has a stroke.

The only time I enable the new expression composer :grin:

Still a nightmare :joy: but im glad to hear that the expression composer is getting stabler

That’s a great idea. I used something similar in one spot but have not used it more universally. I’ll do this where I can. Unfortunately, it’s not only option sets I need to filter on. It could be a set of URLs, values in a state, visibility of elements, etc.

Thank you! This is exactly what I was looking for. I’ve been typing out each individual condition, and if I need to change one in the beginning of the sequence I usually need to retype the entire thing. What you suggest is more straightforward and I only need to input the left side of that equation once. It’s also more clear to read. Thank you.

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