Keeping track of response counts and resetting on restart

I am trying to create an app that takes a user through a series of “yes” or “no” questions. When they click either button, it takes them to the next screen while the app tallies the “yes” answers, reports the total on the final screen, and then (if the user chooses to restart), their answers are cleared and the process starts over. I am getting stuck on that last detail. Any guidance would be appreciated. Thank you.

Hi @CMX2021 ,

Are your questions in the same collection or different (1-to-m relation) ?

if it is in the same collection, it means you have fixed number of questions, then you can use tmp variable (as number) in logged in user, as this is available in all screens.

You can do binary counter for each answer to know which questions is answered yes or no, for example,
if… to yes counter
question 1, yes, add 1
question 2, yes, add 10
question 3, yes add 100

if… to no counter
question 4, no, add 1000
question 5, no add 10000

something like that.

For restarting over, you can just update all of the related properties to empty or 0 or other reset value.

if it is in different collection, you need batch processing, to calculate and reset the answers, but the advantage is number of questions is not fixed.

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.