Condition in Flow Editor/Action Steps Confusing

Hi there!
I have a flow in some actions steps that I’m trying to get to work (user side).

If I don’t use a condition it goes way too fast (I think) and reloads the page before my data is in the database.

It’s good form to use a condition and say, “Once this thing is done, then do this next thing…” right?
So, why isn’t this working?

If I do this it just waits and waits and waits…
But, the data DOES get loaded into my database from the API. So, I’m not sure what it’s waiting for.

Related question: so, these actions steps do not wait for one to finish before the next one begins? They just happen as quickly as they can in a row?

I’ve also tried different values in the condition.

Costtomowbiggerthan0

Check this out: How to nest flow editor after form submit?

Thanks, but there is no form being used on mine.

Not sure I understand what your issue is exactly here, but it’s good to know that the Run steps run asynchronously. This means they don’t wait for the previous step in the flow to finish in order to run, so if everything happens too fast and the data is not inserted but other steps are finished you need to rethink your flow steps and don’t use so many run steps there.

Well, that’s not the part you need to look into either.
Read this:

So, in your case, the condition step runs immediately after serverconnect2.load is called. It does not wait for the server connect to load.

You do understand correctly that the steps execute one-after-another, but since the server connect is an API call, for flow sending the “load” command means its complete. It does not wait for it until it returns data.

You just need to break your flow.
The parts relevant to server connect’s response should be another flow which need to be called on success/fail events of the server connect.

Thank you!
I could hand code that, but…

How do I do that in Wappler?

I think you are not reading the responses correctly. Or the question is not clear on what you are after.
All suggestions are Wappler specific only.

  1. Create a flow which executes the server connect. That it. Nothing else.
  2. Create a flow which does rest of the stuff.
  3. On success dynamic event of the server connect, run the second flow.

How it works:

  1. Something on the app triggers the first flow.
  2. First flow will execute server connect.
  3. Server connect, if run successfully, runs the second flow.

Everything happens via Wappler.

1 Like

I got ya.
This is helpful.

I think I had it confused because I throw over to server connect 2, which is used for multiple pages. So, I wouldn’t always want the success of the that server connect to go to these specific next steps.

I’ll just need to recreate server connect 2 as a separate one. Thanks, sid!

That’s great! A followup question.

What’s the best/proper method for loading API data into a database?
Here, my action hits up the API and then I run a condition that says “if there are records… insert it in the database.”

But, is that vulnerable to the API being slow?
And if it’s too slow will this not insert it into the Database?

Should I make these SEPARATE server actions too?

LOADING API-8

The steps on Server Action function in a different way than flow. Here the execution waits for each step to complete.
So, even if you API is slow, it will wait until it gets a response before executing the condition step.

If this API is really slow, on the client side where you call this server action, it waits for 90 seconds before Wappler throws a timeout error.
I assume the same timeout would be there on the server action too.

There is a field in the “Settings” option up top… in server action - script timeout. But I don’t think it works. Last I remember I tried it on ASP. Maybe it works on PHP and NodeJS.

1 Like