How to shuffle the quetions in local DB?


this is my code blocks i want to shuffle the question in local db? can somebody help me

Hello, if you have a preset/limited number of questions, you can try using below idea -

What this code does is, after displaying your 1st question, the nextQuestion function would select a random row number. Then it removes the chosen random number from the list of total row numbers, to prevent repeating of questions. Also checks if all questions have been shown.

Let me know if this works for you… Cheers! :smiley:

1 Like

how about the choices??

https://x.thunkable.com/copy/db43a20989f65be96bb4bd86430b89be

this is the link of the project please help me to shuffle the questions in local db

Fun Share: Study & Quiz App - Starter kit

Check this out. Learn. Implement. Try first, then ask questions.


how to shuffle this local db?? questions

you don’t shuffle the db.
first create a list of pointers (indexes) to your questions in db.
[1,2,3,4,5,6,7,8,9,10]

then you shuffle THAT list.
[4,2,8,5,7,10,3,6,9,1]

then use the contents of this new list as pointers to the next question.
question 1 will point to the 4th row in db
question 2 will point to the 2nd row in db
etc.

1 Like

thank you

why my data source not showing if a export the project as a android and install it to my phone the questions are not showing

Is your phone an iPhone ?

Can you share the project link?

https://x.thunkable.com/projectPage/653f0cd0292e6b3395fff410

the data source are showing when in live testing but if i install it to my android phone the data source are not working so the question are not showing

Is the data source publicly accessible? If it’s a private Google Sheet or Airtable, you won’t be able to see the data when installed to a phone.

Sorry, I know you said it was a local database. For some reason, this is what I’m seeing when I look at your data source:

If I switch the table in the Get Value blocks to “table1” then I see actual questions and answers when Live Testing on an iPhone 13 Pro.

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