Random trivia questions

Hi, relatively new user here.

I’ve been really struggling to implement a set of random questions to make a trivia game.

Simplified description of the data:
The questions are a column.
The multiple choice options are columns.
The right answer is a column.
A numeric ID column.

I want the questions to display one at a time, and when the users select an answer (it will tell them if they are right or wrong, update the profile row to store that they got a question right/wrong) and then move on to the next question.

How might I do this?


Would you mind adding a screen shot of this?
Just want to be absolutely clear about it.


Cool, thanks.
Just one more question - where do you plan to store the responses?
It looks like you might have a column in that table for responses, but what if more than one person does the quiz?

Let’s see. I didn’t think I needed to store the responses. I was thinking there would be 4 buttons, one for each option. I was hoping that each button could have (almost) the same action, which goes something like :
1.check if correct option number is equal to button number
2. if yes, notifiy, increment right answers and move on
3. if no, tell them the right answer and move on

Okay, no worries.

Well, at the very least you should make your response column User Specific. Otherwise when the second person comes along to do the quiz, the answers from the first person will still be there. Or worse, if you have two people doing the quiz at the same time, then their answers will get mixed up.

To make this work well, you really want to present your options for each question as a list. Then you can have just a single item click action which is based on the selected option. As your options are in separate columns on the same row you can’t do that directly, but it can be done. Navigating cleanly from question to question is also a little tricky, but again it can be done.

I’d recommend something along the following lines:

  • Start by creating an array from your 4 options with a Make Array column
  • Next, create a separate helper table to use to transpose your options into a list
  • Add 4 rows to this table, one for each of your 4 options
  • Number the rows from 0 to 3
  • Add a User Specific column to hold a QuestionID
  • Add a Single Relation column that matches the above QuestionID with the QID column in your Questions table
  • Add a Lookup column that fetches the options array via the relation
  • Add a second lookup column that fetches the correct answer via the relation
  • Add a Single Value column that targets the Array, and selects the row number from start. This should give you a list of options, one on each row
  • In your User Profile column, you will need a Single Value->First->Whole row column that targets the Helper table. This will allow you to set the QuestionID when a Question is selected.
  • Present your Questions as a list. When a user selects a question, configure the action as follows:
    – Set Column Values via User Profile->Single Value, setting the User Specific column in the Helper table to the QID of the selected Question
    – Show details screen → this item
  • On the Question details screen:
    – Add a Text component for the question
    – Add a collection, using the helper table as the source
    – The Item Click action on the collection would need to be something like:
    — If Option is correct answer, then:
    ---- Increment User Profile column
    — Else
    ---- Show notification (or whatever)

The above would get you most of the way there, but doesn’t really handle the navigation. To handle that, probably what you want is a User Specific boolean column in your Questions table that gets set to true as each Question is done. Then what you could do is extend the action on the answers to set that column to true via the single relation when an option is selected, and then go back. And then finally, filter your Questions collection to only show Questions where that column is not checked, and limit the collection to one item. That way they will only see one question at a time, and as they select an answer to each question they should automatically be directed to the next question. (You might want to break that up, and expose a back button rather than sending them back immediately).

I understand the above is quite a lot, but… you did ask :wink: