I have a number of users, each need to answer a number of questions. I need to keep the list of questions dynamic. To achieve this I have a questions thing with the question as a text then a number of possible answers so it is multiple choice.
As this is a many to many relationship I have a joining thing called answers where I store the Question and the answer then a list of answers on the User table.
For the UI I have a repeating group which iterates the questions and displays them, then another repeating group inside this with the possible answers as text.
I run an workflow off of the click on the text which creates or updates the answers thing and adds it to the user thing.
It all works but as I am calling the server with every click it is very slow and not practical.
What I thought of doing is adding a custom state on each ‘row’ of the repeating group of questions to store the answer. Then run a workflow on the click of a save button to iterate the answers and store them server side but I have found such an iteration is not possible.
I’ve been trying multiple ideas but always hit some limitation.
I get what you’re trying to do, but if the number of questions is not long on each page, I suggest saving the answers to the page as a custom state, then make the save button write the answers to the user record when all answers are done. much faster. But if your form is too long, you can add an automation that autosaves every 30 seconds for example, to avoid data loss and user frustration. Here, check it out: Socialapp-ex | Bubble Editor
Thanks for the idea, I had thought of this but I would need to save both the question and the answer and it is not possible to have an array in a custom state. Also the questions are held in a thing and you can’t create a temporary thing on a page without saving it to the database. This seems quite a restriction in Bubble.
What I guess I might try is saving the question and answer in a CS and comma separate them as text. Then split the text and lookup the question thing on save. It is going to get really complicated when the user changes their answer later but I guess it might work.
Not necessarily, if each answer is related to an answer in your data structure, you only need to save answers to a user, it is easy to display the question related to that answer then. Your way is valid of course, I have similar questions and several bubblers attempting to do it but maybe it is more complex than necessary.
Thanks both, my solution didn’t work because of course you can’t iterate the CS either I think the problem with the performance is that I am not using the radio buttons. For the UI I have displayed formatted text which relies on the backend to update for the conditional formatting…