Forum Academy Marketplace Showcase Pricing Features

Using ID on a given workflow

Im setting up a quizz on my bubble app - users answers a few questions, they are given a score and the app prompt the results according to the score. Great

But the thing is: on my wokrflow, when I user starts a quizz and a blank score is created, to keep adding the value of the answers to this same score while the process is going, there’s no option for me instead of “Search for score’s last item” and make changes to things in there.

But the catch is: if another user starts a quizz while this one is on it, because of the “score’s last item” the info gets mixed.

I was hoping i could do a search looking for the unique Id of the score to keep the workflows going… But I cant find this option. I tried to generate a random string while creating a new score to use it as another ID apart from the uniqueId option, but still I cant seem to find any solution instead of searching for the last score and change things this way…

All the users are logged off for this.

Any clues would be appreciated!

You could add ‘score’ as a field under the ‘user’ data type.
So each user can be assigned a ‘score’.

Then you can search for current user’s (or a specific user’s) score’s last item.

Alternatively, you can have a ‘user’ field in the ‘score’ data type and assign a user to each ‘score’ instance that you create. So instead of simply searching for a score, you can search for score with “user = current user” or “user={a specific user}” to refer to a particular score.

Thanks for your support, mate

Would this work if my users are not logged in? I cant seem to make this work when my user is only a visitor that is not logged in… and that is crucial for the app.

You might want to consider not saving a quiz until the user has completed it and just save the score in a temporary state instead of in the database. Is there a reason that you create the score object before the user has actually completed the quiz instead of just saving the final quiz score and doing all the computations in custom states?

Thanks a lot for your time here, mate!

That would work… the only reason I create the score before wa actually to do the math within the database. How could I save this values on a temporary state and just print the final score when the quiz is finished?