Replicating if else loop in Bubble?

Hey all, I have this condition where when the user clicks the button the workflow goes like this:

If (Plan_column = Basic)
{
If(number_of_entries_column ≤ 5)
{
Topic Column = Inputfield Topic’s Value;
number_of_entries_column = number_of_entries_column+1;
} else {
[Toggle a POPUP]
}
}
else if (Plan_column = Pro)
{
If(number_of_entries_column ≤ 50)
{
Topic Column = Inputfield Topic’s Value;
number_of_entries_column = number_of_entries_column+1;
} else {
[Toggle a POPUP]
}
}
else if (Plan_column = Pro Plus)
{
Topic Column = Inputfield Topic’s Value;
number_of_entries_column = number_of_entries_column+1;
}

How do I make this loop into a workflow?

For Plan_column = Basic I’m using the “basic” as an arbitrary text and number_of_entries_column = number_of_entries_column+1 is working fine.

But I can’t figure out the if {if {} else {}} else if {if {} else {}} else part. I know it’s possible through Only when expressions, but I couldn’t figure out how.

Can you guys please help me out?

Thanks

If, else can be done using conditionals for the workflow.

You can separate each possibility as a new workflow.

When button XYZ is clicked <with conditional possibility #1>
(……do these steps….)

When button XYZ is clicked <with conditional possibility #2>
(……do these steps….)

It seems you only have a few possibilities, and I don’t see any “loop” so please let me know if this isn’t what you’re looking for.

Do you mean creating separate actions with only when conditions for Plan_column = Basic & number_of_entries_column ≤ 5 and Plan_column = Pro & number_of_entries_column ≤ 50 ?

Sorry for calling the loop, it isn’t actually, old habit.

When you set up conditionals on an element they will be processed in the order in which they appear and those further down overwrite those further up.

For actions, you can work with custom events and also create conditionals. This makes it a little clearer.

Well, adding another action with each condition seem to be working fine. I think That’s the way you’re suppose to do it in bubble.

1 Like