# Make a random question list without showing answered questions

**URL:** <https://community.thunkable.com/t/make-a-random-question-list-without-showing-answered-questions/590481>\
**Category:** Questions about Thunkable X\
**Tags:** firebase\
**Created:** [May 25, 2020, 11:10pm UTC](https://community.thunkable.com/t/make-a-random-question-list-without-showing-answered-questions/590481 "2020-05-25T23:10:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![oreeldadln](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/oreeldadln/32/89185_2.png) [@oreeldadln](https://community.thunkable.com/u/oreeldadln)\
**Post date:** [May 25, 2020, 11:10pm UTC](https://community.thunkable.com/t/make-a-random-question-list-without-showing-answered-questions/590481/1 "2020-05-25T23:10:55Z")

</div>

Hello!

I’m breaking my head about finding a way to build a test app that shows random questions but with an option to not show questions that the user has already answered (answers saved on Firebase of course).

Thanks in advance…

---

<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:** [May 26, 2020, 4:41am UTC](https://community.thunkable.com/t/make-a-random-question-list-without-showing-answered-questions/590481/2 "2020-05-26T04:41:53Z")

</div>

create 2 columns in your database:

1. **n\_ans** number of times this question has been answered
2. **n\_ans\_ok** number of times this question has been answered correctly.  
make sure to update these 2 fields immediately after an answer is made to a presented question.

create a subroutine, **getQList** which returns a list of row\_numbers, or row\_id or some field that makes the question unique and can be used for obtaining a row from the database. allow 2 input parameters:

1. filter\_option ( **1** =yes apply filter; **0** =no, do not apply any filter , ignore filter\_type)  
2 filter\_type

- 0 means **n\_ans** is equal to zero
- 1 means **n\_ans** equals **n\_ans\_ok** ,
- 2 means **n\_ans** greater than **n\_ans\_ok**

create the list of questions by calling **getQList** with the desired combination of filter\_option and filter\_type  
randomize the list  
iterate over the list - for each entry, obtain the corresponding row from table and present each question, ask for answer, update table.

---

<div class="post-metadata">

**Author:** ![oreeldadln](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/oreeldadln/32/89185_2.png) [@oreeldadln](https://community.thunkable.com/u/oreeldadln)\
**Post date:** [May 26, 2020, 8:56am UTC](https://community.thunkable.com/t/make-a-random-question-list-without-showing-answered-questions/590481/3 "2020-05-26T08:56:32Z")

</div>

Have to admit that I got a little confused with it. I sharpen the question a bit.  
It’s going to be a personality test so there are no right or wrong answers.  
I just want the answered questions that had been sent to firebase to not appear again (unless a toggle is on).

If so, do I still need the second column or just one column enough?  
I am currently taking the questions from the locale db - I did not understand where I should put them now …

Thank you!

---

<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:** [May 28, 2020, 8:59am UTC](https://community.thunkable.com/t/make-a-random-question-list-without-showing-answered-questions/590481/4 "2020-05-28T08:59:24Z")

</div>

you’re right - you don’t need the 2nd column. you may not need the 2 parameters in the subroutine anymore. but you may want to replace them with one global variable to indicate (apply filter or not) and if filter is to be applied, you only need to check n\_ans is zero or greater\_than\_zero.  
the local db can contain your whole test. or you can store it in airtable, or firebase. you need the ability to help you get a specific record directly by using its “key” field.

---

<div class="post-metadata">

**Author:** ![oreeldadln](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/oreeldadln/32/89185_2.png) [@oreeldadln](https://community.thunkable.com/u/oreeldadln)\
**Post date:** [May 28, 2020, 10:12am UTC](https://community.thunkable.com/t/make-a-random-question-list-without-showing-answered-questions/590481/5 "2020-05-28T10:12:00Z")

</div>

I Used those blocks to create a folder in the realtime DB

 ![Screen Shot 2020-05-28 at 13.03.32](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/6/a6c167d91fb98e0bf49182e456e875c984495e3a.png)

and used this block to create get a random number that will be compared to the ones in the first blocks.

 ![Screen Shot 2020-05-28 at 13.06.04](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/0/50f95680a04b0aacf681baa8f669050e1cd7296a.png)

I have tried dozens of ways to pull data from the DB and if the information does not exist to create the requested functionality, but nothing works ☹

Could you please explain to me in detail how to do it?  
I’m pretty sure there is a smarter easier way to do this function.

thank you so much!

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:28am UTC](https://community.thunkable.com/t/make-a-random-question-list-without-showing-answered-questions/590481/6 "2024-11-08T11:28:57Z")

</div>


