I’ve been using Bubble for the last few weeks now.
I went through all video and learning tutorial but until now I’m struggling to find a simple and a standard way to use the “if” formula.
Unlike Excel where it’s straight forward formula I find it a bit tricky and no so standard to use If formula in Bubble.
Can someone give me a tip on the best way to implement If formula ? (as simple as “if this happens , do that, if not, do that otherwise” ).
Set up a series of if-then-else statements in seconds. When a ‘If’ condition is true, the If-then workflow element runs the workflow corresponding to the ‘then’ condition
Set up a series of if-then-else statements in seconds. When a ‘If’ condition is true, the If-then value element gets its ‘value’ from the corresponding ‘then’ value you define
Plugin : https://bubble.io/plugin/utilities-bdk-1544798294930x973076470769909800
To be clear, you don’t need a plugin to implement conditional behaviour in Bubble. You can set conditions for an element using the Conditional tab of the element’s properties pane.
You can also set workflow and workflow steps to run conditionally by putting a condition in the ‘Only when’ field.
I haven’t used it myself yet but I think the plugin that @JohnMark shared builds on this and gives more flexibility but I just wanted you to know that it isn’t necessary in most cases, in case that wasn’t clear.
This confused me at first as well. You’ll need to adjust your thinking to the Bubble way, but you’ll get there.
2 things you might find useful:
There is not “then” or “else” in Bubble. Only “if”. This seems like a limitation at first, but it’s really not a big deal. Just make your if statements specific like, “if X” on one workflow and “if not X” on another. There’s your if/then statement. Of course you can make this more specific like “if X and Y” which basically gives you “then” functionality. It’s not that hard to build up 4 or more conditions, just make sure you plan well and avoid overlap.
as @louisadekoya pointed out, there are actually two different places your programing could go. In workflows or in conditional statements. At first I was making workflows to hide and show buttons based on the current state of an interface, but then I realized that those things can be simplified in conditional statements.
we have created checkboxes in order to confirm or refuse a booking on our website.
However, we have noticed that when you tick the box “validate” and want to change it to “refuse”, you would have to untick the “validate” box before ticking “refuse”.
Fyi, we had to create 2 separate groups for “validate” and “refuse”.
Is there a more efficient way to do it?
Yes, you can set a ‘state’ for both of them and then save to your database from the state instead.
You can use conditionals to automatically change the other check box based on the set state as well.
Or you can use a radio button instead.
Instead of using a boolean yes/no field, you can use a text field and refer to one field instead of two.
Does that make sense?
Hope that helps!
For All Your No-Code Education Needs:
- One-on-One Tutoring
- eLearning Hub
- Video Tutorials
Try using icons instead of checkboxes, as this lets you be a bit more flexible in how you can display them based on conditionals (i.e. you can uncheck one when the other is checked - I don’t think you can do that with checkboxes). Plus you have more control over how they look.
Then you’ll need to set up a custom state somewhere to hold the selected value (valid or refused), then set up a workflow to set the states accordingly when either icon is clicked.
Alternatively just use a single checkbox to indicate whether the booking is approved or not
Simple (Ha Ha after spending a whole day trying to do something similar):
“Preset status” of both checkbox should be “Dynamic” , leave “Dynamic status” blank.
Enclose each checkbox in a separate group (because you can reset group data in a workflow).
Here’s your workflow – similar for each checkbox: When checkbox A’s value is changed and checkbox A is checked – Reset Group B (the group containing the other checkbox)…and vice versa