Make workflow wait on DB update?

Hi all,

Quick question, currently after a user sends an input to the database, I want a couple of calculations to be performed. It appears however this does not work because the database is not finished yet updating and thus data of an earlier entry is used for the calculation ( search for…last item). How can I make sure the calculation is only done after the database update has finished?

1 Like

Hi @SenorPelota, did you get any answer to your question or where able to solve the case ? I am having the same issue: on a simple page, clicking on a button starts a workflow that creates 48 entries in a Thing and then a RG shows those entry. The problem is that the workflow ends fast but the data are not already update. As a result the RG shows only a portion of the list.

Is there a way to set up a workflow step that actually waits until data are update before run ?

Is it still happening with the following approach?

Generally speaking, if you want to make sure that action 1 is run after action 2, you have to use “result of action 1” in the conditions of action 2. Otherwise, Bubble tries to speed things up and the order might be another.

In all the 48 “create things” action (except the first, of course) I added the condition “only when … result of previous step is not empty”. But then I run into another problem. The workflow start with showing a spinner popup, then hide a collapsable group, then create things (48 times) and at the end hide the popup and show the repeating group that lists the 48 records newly added. In step-by-step and slow debug mode everything is fine. But in normal mode there is no way to see the popup as well to show the final step (RG with the results). Now I was thinking about using a custom event for the create things actions, to be inserted in a normal workflow. What do you think, @reger-alexander ? Any other advice ? Thanks

Have you also put according conditions on the hide/show actions? The hide popup action for example should have the condition “only when result of…” the last step of the 48 create things steps is not empty.

Hi Stefano, I am having the same problem (6 years later). I still can’t find a way for the RG to show recently created data.
I built an ugly workaround using “Do every 5 seconds” where it will send the data to the RG a few times to make sure the RG is displaying all the data.
But the question remains: how can the RG display data created after the search was done?

Have you tried the action display/send data in RG?

Yes, but I can’t place this step after the API workflow that creates the things as they do not run one after the other. What I need is to:

  1. On page load, create X amount of things using API WF
  2. Once created, display the data in the RG

Putting these steps back to back doesn’t work as API WF runs asynchronously, meaning that sometimes the search will find the created things and sometimes it will not, depending on who runs faster: the API WF or the RG search

Is the issue that the data isn’t in the database yet, so Display data finds an empty list?:thinking: Would using Display data on a custom state, and then running a new search after the custom state is set, be a more reliable approach?:thinking:

@paulo.rosales97 I have a theory you can try.
Create a Custom State, Data type should be the Data type of the thing you need to create.

  • Step 1: On page load, add the last item of that Current Database record/list to the custom state.
  • Step 2: Run the API WF. This will trigger to start creating things

If you know the quantity of items that was created, you can add a workflow, Do when condition is true (Every time), When the Database record’s last x amount of data does not include the custom data’s value, Run your action

Note: I dont think you can do “last x amount”. So you can do :items from #(Do a search for Data :count - the total number of WF created items)