Hi everyone,
I’m working on a quiz app for my diploma project, using the official Thunkable tutorial on YouTube (it’s titled How to Create a Quiz App with Thunkable)
Since my inspiration is Kahoot and other similar quiz apps, I want to randomize the questions each time the quiz starts. The questions and answers are pulled from a Google Spreadsheet, and I’ve tried various methods to shuffle them, but nothing seems to work.
I’ve searched many tutorials for quiz apps, but i’ve found nothing; also the original thread for the Quiz App tutorial is closed.
Is there anyone who has built something similar or who can help me create the logic for a question randomizer correctly in Thunkable?
Any help or example blocks would be really appreciated!
Thank you!
P.S.: I also want to disable the answer buttons when the timer runs out. However, when I tried doing that, all the answers get greyed out before showing which one was correct or incorrect. Ideally, I want the correct and incorrect answers to be highlighted first, and then disable the buttons — so that players can’t change their answer after seeing the correct one.
Thanks in advance for your help!
Hi,
Off the top of my head, in order to randomise and not repeat questions, you need to create another Google sheet
Question Number |
Asked |
1 |
N |
2 |
N |
3 |
N |
etc.
At the start, update the sheet to reset all Asked to N, then generate a random number between 1 and the last question number.
Query the questions sheet to check value of Asked.
If it is N (should be on the first run), change value to Y and then select that question number from your quiz table.
If it is Y, repeat random number generation and rerun check.
Repeat until all the questions have been asked.
Thank you for responding to my question.
I’m trying to understand your solution, but I’m building an app based on a spreadsheet like the one shown in the Thunkable tutorial (this is just an example I found there).
That means I’m not sure how much I need to change the existing app blocks to work with this new sheet. I just started learning Thunkable on my own two weeks ago, so if it’s not too much trouble, could you please explain your solution step by step? (Basically, explain it to me like I’m five!)
P.S. I’ve tried using AI models for help, but they keep giving me results for the old version of Thunkable.
Hi,
So there should be only 2 changes -
1 - Create a new Google Sheet (let’s call it QAsked) as follows -
When the app starts, all the rows in the column Asked should be (re)set to N.
2 - At the moment, the app variable question_number is initialised to 1 and then incremented by 1 after each question has been answered. Rather then doing this, the question number should be determined by generating a random number between First question number and Last question number.
Once that number has been generated, a check will be done in the QAsked sheet to see if Asked is set to N for that question. If it is, then the question can be asked. If it is set to Y, a new random number will be generated and the check done again.
When a question with Asked set to N has been found, the question is displayed and the Asked field is set to Y.
Once the question has been answered, the process of generating a random number repeats.
The easiest way to to do this is to place the random number generation and QAsked check in a function which will return the question number to the main logic.
and the function will be like this -
Hope that this helps.
So how should i incorporate both Google Sheets (QAsked) and the one with questions and answers in the app (i’m using the free version)
I am pretty sure that you should be able to include another Google Sheet in the free version. Just add it in Data Sources.
I might add that this solution is only valid for having 1 user. If you have multiple users, then you will need to create a new QAsked sheet for them on the fly.
i i understand your response correctly, this quiz app will have multiple users
So, yes, this is a little more involved. Let me give it some more thought. You will still need to do the random number generator but I will work out the best method to check to see if the question was asked.
Might involve generating a session number for each used and creating a text variable with the asked number stored in it. Will get back to you in a bit.
do you have a discord account. or is it possible to do it in a more simpler way. or maybe explain to me slowly step by step based on the blocks i currently have as i really don’t undertsand your idea of adding another database