Send processed value back to frontend

I’m scratching my head here and feel like I miss something obvious.
Which is the clean Bubble-way to implement the following?

  • User clicks ‘Save’ in a form in the frontend
  • Data is saved in the DB
  • Additional fields are saved in the DB based on the result of external API calls
  • Once the DB entry is complete, the user gets a message with one of the additionally calculated values

Thanks in advance

Do a search for?
I don’t see any reason to use something else for you case. (Or Display data… but this depend of your layout/pages)

As for the message… which kind of message? In-app notifications system? Push notifications? Email?..

@Jici, thank you very much for stepping in.

message = text

How and when would you trigger the ‘Search for’? How does the front knows when the background workflow with all the external API calls is done? Is there a better way than repeating a ‘search for’ every second?

You don’t need to repeat the search. Bubble will update the display in front end as soon as there a change in DB.

This depend on how you want to process and what is your workflow exactly.
Let’s say you are calling three different API, and store the result of each of them in the item “form”

User click submit form: you create new “form” in DB and schedule an api workflow to process api calls. you navigate to another page where the type is form and you use result of step 1. On this page, you first display a “loading spinner” or something like that saying: We are processing your form, please wait. This is show base on conditonnal (if current page “form” API 1 result is empty OR API 2 result is empty OR API Result 3 is empty). You have another group that will only show when current page “form” all API are NOT empty. At this moment, you will show the results stored on this page.

This is one way. But you could also have a page where you show all “forms” submitted for this user with a Do a search for form (created by = current user). You could even show a progress bar (0%, 33% after 1 api call is completed based on the results stored in the “form item” and so on…)

You could also chain all api call (however, if you don’t need too, you could process them all at the same time too…) And because you chain all api call in backend WF, just after the API call is completed in backend, update the “form” item with a new status: Processing API 2, Processing API 3 , Completed… So in front end, you can show the item when it’s completed for example or do a search for form completed (and also send text message at this moment)…

Again… this depend on a lot of things and how you want to work with data and display them in front end. But keep in mind that an item updated in backend will display directly in frontend too if you don’t use state.

1 Like

Thank you very much @jici for the detailed explanations. It works and it feels very logical and clean and easy now.

1 Like