Added Goto if actions - allows for if-then-else and looping within actions #10123
Replies: 8 comments 1 reply
-
You also need a action for "stop" case , and an infinitive loop prevention flag , GOTO in all programming language easy lead to inifinitive loop and crash |
Beta Was this translation helpful? Give feedback.
-
For avoidance of endless loops arising from improper configuration, one can add this line |
Beta Was this translation helpful? Give feedback.
-
thanks so much for your kind words and your contribution, it's definitely a feature that I've wanted at times. I tried the updated action out on your fork locally and it seems to work well! You're welcome to submit your changes to our repo as a pull request. When you do so a member of the engineering team will review it and merge it if they feel it is suitable for the core product. You may need to merge the latest changes from our develop branch to your fork before it will merge cleanly. Thanks again for the contribution! 😊 |
Beta Was this translation helpful? Give feedback.
-
Have added Goto if for automations too, thanks to God! Fork remains the same, docker container can be pulled from ichthysmaranatha/budi:v2.4.32.20 When test running automations, the test details display block shows all steps in created sequence, though execution may be jumped by Goto if. One has to check the inputs and outputs of each test block to see the actual execution sequence and steps as they will be mislabelled. @andz-bb please test this |
Beta Was this translation helpful? Give feedback.
-
I'm sorry, this jumps to the right step but has other issues. Will try to correct this. |
Beta Was this translation helpful? Give feedback.
-
Have corrected code. Works now with correct bindings. Looping also works, api counters such as these can be used https://countapi.xyz/ Tested using webhook trigger, some other triggers do not seem to be working well even with non-modified budibase Only the cosmetic test details panel does not reflect execution run correctly as mentioned a couple of posts above. Automation history shows correct flow of steps for actual automation run. Docker pull: ichthysmaranatha/budi:v2.4.32.30 |
Beta Was this translation helpful? Give feedback.
-
We do more complex "automations" like data integration jobs, more complex API calls, (mail) notifier with n8n. Concept is: Budibase = frontend, n8n = backend & being used as (ETL) job server, integration plattform and for workflow automations and third party service integrations, that are common today. (MS Graph calls, automatic mail processing) or requested integrations, that are not possible with Budibase and where we cant or dont want to create a self-coded solution. (C#) Budibase & n8n is a powerful combination, that's why alot of people are doing this. AFAIK n8n is considering to integrate Budibase even deeper and better, because of the demand. (Which is a good sign IMHO for the Budibase devs and community.) They never did that for retool or Appsmith, which are BB biggest "competitors". So from our perspective, I would suggest to concentrate with BB automations on features that help BB core use case: low-code, data-centric, modern looking business web apps. |
Beta Was this translation helpful? Give feedback.
-
I complete this idea of @IchthysMaranatha with production ready commit here: |
Beta Was this translation helpful? Give feedback.
-
First of all I'd like to thank the Budibase developers for building this wonderful piece of software and open sourcing it. May God bless you all.
Have added Goto if in actions (with His help), which enables If-then-else and looping within actions. Fork is here https://github.com/IchthysMaranatha/budibase Docker image is available here https://hub.docker.com/repository/docker/ichthysmaranatha/budi/tags?page=1&ordering=last_updated
For eg, if you need an action workflow like this
2 common actions - if x=3 then 3 actions - else 2 actions - followed by common actions,
it would be set up as follows
Actions 1 and 2 - common actions
Action 3 - Goto if x not equals 3 Action 8
Actions 4-6 actions for if
Action 7 Goto if 1=1 Action 10
Actions 8-9 Else actions
Action 10 onwards - resume common actions
If you need a loop like
repeat set of 3 actions 4 times
then it would be set up as
Action 1 Update state ctr javascript return 0; (plain 0 is taken as string and further increment concatenates)
Action 2 - 4 the 3 actions you need repeated 4 times
Action 5 Update state ctr javascript return $("State.ctr") + 1;
Action 6 Goto if (state.ctr not equal 4) Action 2
Action 7 resume normal actions
Care must be taken not to create endless loops. If the Goto action no is less than 1 or greater than the total no of actions defined, it will just go to the next action without doing anything.
Beta Was this translation helpful? Give feedback.
All reactions