Compare values - if true ... then... (in a condition)

Hi all,

here’s a record in my database (a list of text):

In my app there’s a multidropdown where the user can choose one or more items:

image

Now I want to set a condition to set another color (light red) on my element’s background only if one or more selected items from the multidropdown matches to one or more matching items that appends the string " | yes". I thought I could do it this way, but nothing happens:

Any ideas?

Other explanation of this problem:

  • If the user selects “Bayern” in the multidropdown, then the condition should be false, because there’s no matching element in the list (bayern|no).
  • If the user selects “Alle Bundesländer” in the multidropdown, then the condition should be true, because there’s a matching element in the list (Alle Bundesländer|yes).
    Remember: If just one of the elements in the list has a matching MULTIDROPDOWN|yes matching a db item, then the condition should be true.

Should I provide more information?

many thanks in advance,
jupxi

Use the :intersect with operator in Bubble to achieve this - Operators and comparisons | Bubble Docs

Ideally
Parent group’s TAG woFeiertag-TOPDOWN :each item’s Display :filtered (This text :split by (|) :item #2 is yes) :each item’s Display :split by (|): item #1 :intersect with: Multidropdown’s value :count > 0

So, you’re filtering all the items in your DB that have yes after |
And then matching that with the Multi-dropdown’s value. The moment any item is encountered that’s common to both lists, the conditional gets activated

Hi Zeroic,

this is not possible:

I’m crying :frowning:

This is a list of texts:

This is also not helpful. Can’t use “:intersect” here:

Also this is not helpful:

Any ideas?

You can try this:

Your List: filtered [this text contains |yes|]
: each item extract with regex [ ^.*?(?=\|yes\|) ]
: intersect with Multidropdown value [Assuming this is set to type Text]
: count > 0

Note :filtered will give you list of Texts with |yes| and then using regex we are extracting the text before |yes|

1 Like

I understand this function, but it doesn’t work:

No error message.
Maybe it is the multidropdown’s Type of choice:

But if I change it to “text”, i’ll get this:

:frowning:

If the multidropdown is a List of Option Set values and if you are trying to match the text before |yes| with the option set’s Display, then try this:

Ah, okay. I understand. Did it, no errors. But nothing happens (??):

Really strage. Is there a possibility to check or debug ?

Use the inspect element at the bottom right → drill down on each operator. I have tested with some dummy data, it’s working fine.

one more thing, if you have multiple conditions on the element, check if any of them are overlapping. The order of those conditions matter.

best way to test - just test with one condition or add this condition at the last

Please refer to this video - https://www.youtube.com/watch?v=0Wky_g6es_s

Hello,
take a look at this, please:

Something seems wrong (with :intersect, maybe). The result is “0”. :-/
Could you help me, please?

Got it! Many thanks at all! :smiley:
It works!!!