How To Toggle Yes/No Values

If you use a custom state as a yes/no value, or use yes/no in other areas that may be tricky to optimize the change of value, one way to effectuate the change for a custom state has been to have two triggers with conditions so that one is when yes, set state to no, and the second trigger is when no, set state to yes. I’ve been doing that for the longest time.

Now, I do this instead.

One trigger with no condition, and one action to set state with the value equal to the custom state value followed by conditional comparison of ‘is no’…what does this do? It evaluates to a yes/no, so when the current custom state value is no it evaluates to yes and sets the value to yes, and when the current custom state value is yes, it evaluates to no and sets the value to no.

This is essentially a toggle for yes/no values

3 Likes

Bet you kicked yourself when you worked this one out :rofl:

3 Likes

yeah, enough to make it public knowledge

2 Likes

We are rediscovering ancient indigenous knowledge. Love to see it.

1 Like

Nice find buried in the threads from yesteryear…man how I wish my skill set after 5 months on Bubble from March 2018 to that post from August 2018 was robust enough to have even comprehended what that was about.

1 Like

I actually found it out from a random YouTube short when I was first starting to learn Bubble, thank god for the algo.

1 Like

I was lucky to learn it in my very early days of learning Bubble. It was a not-very-easy-to-find video by one of the seniors, @keith I guess. It has been a great convenience ever since and something that I use all the time.

I remember watching keiths video explaining booleans 3 years ago and being so confused until it suddenly made complete sense, lol

2 Likes