Forum Academy Marketplace Showcase Pricing Features

Toolbox plugin - collection of utility elements

Haha my 2 favourite bubblers!!!

3 Likes

Mine too :grin:

Huge thanks to @mishav for helping get this working for me.

Will write it up elsewhere but in summary, I was running an SQL against a Google Big Data view but to save space/repetition Google tells you the data structure once, and a mess of "f"s and "v"s to represent the data. 7 lines of name:value pair JSON is turned into 10x lines of mess.

Google doesn’t think anyone would do this without access to the code libraries to put it all back together again, so the code above does this.

Run SQL return as Text > Parse the Text to JSON and pass to the Server Script > Output Text > Pass Text to an API Workflow so Bubble can Parse it back as JSON.

Phew :joy:

3 Likes

@mishav thanks for the toolbox. Can you confirm how long it takes the “List Item Expression” to evaluate a data source list?

My use case: I built a 3-page quiz in bubble. As the user completes each quiz page, their responses are added to a “response list” saved on the quiz. Once the user provides responses for the third/last quiz page, I need to post the Quiz ID + the full list of responses to an external API.

I successfully converted my quiz response list into a JSON text string by adding the “List Item Expression” element to quiz page 3 (source type = response, data source = Quiz’s response list). The problem is, the List Item Expression does not capture the responses from page 3 (even though my workflow stores down the user’s page 3 responses to the response list before executing the API Post). The weird part is I can see that the JSON string includes the full response list, but the POST only includes the responses from the prior 2 pages.

My hypothesis is that this is a timing issue/ that the “List Item Expression” runs in parallel and is too slow. I am trying to trigger the entire workflow from 1 button click (i.e. user hits “submit quiz” --> add responses to response list, post quiz + json formatted responses to API). It seems like the interim step for the List Item Expression to refresh the JSON string happens in parallel/ but isn’t fast enough.

I tried moving the API Post to the next page (i.e. user submits quiz --> navigate to results page; on page load, POST Quiz using a List Item Expression on new page), but that was even worse. This time the List Item Expression is blank when the POST runs. Eventually the JSON string with all Quiz Results shows up, but it’s just too late.

Is there any way to accomplish what I’m after without using the Schedule API Workflow? I can’t justify/ afford to upgrade my Bubble Account at this stage just to get this feature.

Hi @project200tango, it sounds like List Item Expression isn’t a good fit for your usage, as it updates when its source changes. I recommend a more workflow oriented approach.

For example, as the responses are captured, append each to a text field to build up the JSON, and store at each page completion.

Depending on how the text field is built up, it may be useful to Run Javascript and transform the text, then bring it back to a new workflow event with Javascript to Bubble, for use in the API call.

Good luck!