Is it possible to directly write in list of texts to check for a condition?

In Python it’s possible to write an expression like

if "apple" in ["banana","pear","apple"]

That expression would return True because the text apple is in the list ["banana","pear","apple"]

The functional equivalent in bubble is

[List Field] contains [Single Entry]

I can do this currently with an expression like so;

where the expression is:

… but it would be nice if I could do that all inline. Is there a way to write in a list of texts directly in the conditional statement? like:

@zelus_pudding This is probably not what you’re looking for, but I just wanted to send it incase it may be helpful! You could have an empty custom state list of texts (on the page for example), and then use :plus item to add in the text values you need into the conditional. For example, in the screenshot below, there is a custom state called “Empty list of Texts” (type: text, list: no) on the index page, which is always empty. When a User types in a fruit which matches banana, pear, or apple, the page will turn blue. Since it’s a custom state list of texts, Bubble allows you to use :plus item in the conditional to add other text values. It’s a little tedious, but it works! :slight_smile:

1 Like

Hey Faye, I hadn’t considered that route. I guess this will be about the closest I’m going to get if not using expressions. Thanks for the suggestion!!

1 Like

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