# How to shuffle the quetions in local DB?

**URL:** <https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621>\
**Category:** Questions about Thunkable X\
**Created:** [October 30, 2023, 2:45am UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621 "2023-10-30T02:45:29Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![adriankier.aquino.1q](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@adriankier.aquino.1q](https://community.thunkable.com/u/adriankier.aquino.1q)\
**Post date:** [October 30, 2023, 2:45am UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/1 "2023-10-30T02:45:29Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/7/07828d0a5c41b820a84a21b1e582d12a6a16313e.png)  
this is my code blocks i want to shuffle the question in local db? can somebody help me  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/1/c13d7bf9a4dc7076cca8ecaced291010c397cf4d.png)

---

<div class="post-metadata">

**Author:** ![kartik14](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kartik14/32/44782_2.png) [@kartik14](https://community.thunkable.com/u/kartik14)\
**Post date:** [October 30, 2023, 4:04am UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/2 "2023-10-30T04:04:04Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/a/da2e6ebfbb330592ba12f46226063ec1ac9cb6e2.png)

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! 😃

---

<div class="post-metadata">

**Author:** ![adriankier.aquino.1q](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@adriankier.aquino.1q](https://community.thunkable.com/u/adriankier.aquino.1q)\
**Post date:** [October 30, 2023, 9:41am UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/3 "2023-10-30T09:41:51Z")

</div>

how about the choices??

---

<div class="post-metadata">

**Author:** ![adriankier.aquino.1q](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@adriankier.aquino.1q](https://community.thunkable.com/u/adriankier.aquino.1q)\
**Post date:** [October 30, 2023, 12:09pm UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/4 "2023-10-30T12:09:11Z")

</div>

[https://x.thunkable.com/copy/db43a20989f65be96bb4bd86430b89be](https://x.thunkable.com/copy/db43a20989f65be96bb4bd86430b89be)

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

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [October 30, 2023, 12:24pm UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/5 "2023-10-30T12:24:31Z")

</div>

[Fun Share: Study & Quiz App - Starter kit](https://community.thunkable.com/t/fun-share-study-quiz-app-starter-kit/1858966)

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

---

<div class="post-metadata">

**Author:** ![adriankier.aquino.1q](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@adriankier.aquino.1q](https://community.thunkable.com/u/adriankier.aquino.1q)\
**Post date:** [October 31, 2023, 3:00am UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/6 "2023-10-31T03:00:41Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/4/f416eff482e824761eb8e0a34f763dc5fe420e7a.png)  
how to shuffle this local db?? questions

---

<div class="post-metadata">

**Author:** ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)\
**Post date:** [October 31, 2023, 5:03pm UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/7 "2023-10-31T17:03:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adriankier.aquino.1q](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@adriankier.aquino.1q](https://community.thunkable.com/u/adriankier.aquino.1q)\
**Post date:** [November 1, 2023, 6:28am UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/8 "2023-11-01T06:28:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [November 1, 2023, 11:42am UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/9 "2023-11-01T11:42:52Z")

</div>

Is your phone an iPhone ?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [November 1, 2023, 2:22pm UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/10 "2023-11-01T14:22:53Z")

</div>

Can you share the project link?

---

<div class="post-metadata">

**Author:** ![adriankier.aquino.1q](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@adriankier.aquino.1q](https://community.thunkable.com/u/adriankier.aquino.1q)\
**Post date:** [November 2, 2023, 2:08am UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/11 "2023-11-02T02:08:30Z")

</div>

[https://x.thunkable.com/projectPage/653f0cd0292e6b3395fff410](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

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [November 2, 2023, 3:38am UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/12 "2023-11-02T03:38:30Z")

</div>

~~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:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/b/bbb2721a7214fec0d1600b9910d767909f7e042b.png)

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [January 31, 2024, 3:39am UTC](https://community.thunkable.com/t/how-to-shuffle-the-quetions-in-local-db/2670621/13 "2024-01-31T03:39:15Z")

</div>

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