I have a friendly bot who provides assistance to my users. Some elements on the page have a drop down menu with the option to “explain this”. When this is selected, the bot explains something.
I do this with a bot templates table which a workflow pulls from and creates a “thing” in the bot messages table with is connected to a repeating group.
But, to make sure that the user is not pressing the “explain” function more than once, I added a condition to said workflow to see if the last message posted is not identical to what it intends to post. if it is, then do nothing.
This is achieved by comparing two states on the button pressed. One state is “element” which just identified the element and the other is “type” which is “explain”. If the message in the messages table as the same “element” id and the same “type” then it is the same message.
The condition works well for each of these separately. But when I put both of them with an AND between them as shown, it works only once - the first time. So far I have not been able to crack why the AND fails it.
Did you have a look at the conditions using the debug mode? If not, it should be quite easy to see why the condition is not working well. When you open the page using the preview button, the debug mode will be active and this allows you to step through the workflow actions and see why a certain condition is true or not.
Thanks @gerbertdelangen I did know of the debug function but not about clicking on the element which reveals its content - that is helpful. It also clarified what the issue is.
What I need is equivalent to:
If (x==1)
if(y==1)
…
and not if(x==1 && y==1)
What is the best way to implement it in a workflow?
Hi @tal2 , sorry for the late reply, missed your message, you probably already found the solution.
Just to be sure, you probably can use “If (x==1) or (y==1), do …” right? The screenshot in your initial post contains (Search for QMessagess:first item’s Type is not This Buttons type) and (Search for QMessagess:first item’s Element is not This Button’s element). You can click on and and make an or from that.
Hi @gerbertdelangen no worries and I figured it out.
It is not a matter of AND / OR since a nested “if” or “if/else” goes through the steps differently.
With AND
Do action if both x=true and y=true
with OR
Do action if either x=true or y=true
with else
Check if y=true only if x=true
This can be achieved with a workaround (like many things on Bubble it seems) by using custom states (again, like most solutions on Bubble). Basically:
set “found” state to yes if x=true
set “found” state to no if x=true AND y=true
rest of workflow