Getting data on-the-fly from API

Hello,

I am new to bubble, and I am trying to develop the following app:

App starts with a question and a multi-value drop down to chose the answer. First API choses the best question to ask, then this question and its possible answers are sent to Bubble, and displayed with a text field and a multi-value drop down. User choses the answer, clicks the button then the answer is sent back to the API, an operation is done, server choses the second question, sends it back and so on…

THE LOGIC ON THE BUBBLE SIDE
Since you cannot trigger creation of new bubble elements from the backend, I have created the question & multi-dropdown answer pairs before hand and hid them on the screen. Every time user click the button I show the next q&a placeholders. And the new chosen question and its possible answers are sent to a data holder (which is just a hidden text box in a group) from the API, and every q&a pair reads the next question from there. The reason for this approach is: the questions are not determined before hand and I cannot manually match every output of the API call to the every q&a pair. Since it has to be done on the fly. However this creates a problem. The problem is I am losing the old questions, every question and answer pair in the screen is updated since they are reading from the same element.

Is there a way to overcome this? I was thinking maybe on every button click I can change the data source of the previous questions so that they would point to the old questions? And I can do it this with a database? I am open to any kind of ideas. It has been challengin for me.

Hello @didem , welcome to the Bubble!

As of my understanding on your project, you have a Q/A test which its data coming via API.

Yes. You can’t create new Bubble elements from backend however you don’t need to create a new element for every question. You just need to create a dynamic page which will display related questions bounded with their answers.

With building your database structure you can store every question comes via API and every user’s answer from related question.

For better understanding, -if you don’t mind- could you share your editor or screenshots about related page?

You can create new element structures from the front or from the backend

Just use an rg of type number (or an actual data type if you wish) and place your structure or structures within the single row group child.

Basically … you will be building a dynamic form builder (like Google Forms)

I understand but the number of q&a pairs is not deterministic, so I cannot use RG. Because I do not know how many questions will be asked to the user, that depends on the algorithm