web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Excel data base for a ...
Power Apps
Answered

Excel data base for a quiz. Make each row a individual question

(0) ShareShare
ReportReport
Posted on by 30

Hello community ! 🙂

I'm doing an App for a quiz. 

Facts: 

- I have an excel table of 300 rows with questions, 4 possible answers and the correct answer

- I created a gallery, use filter, shuffle, firstN and limited the questions to 25. 

- Each time I refresh I need to get 25 new question from the table

 

Problem? 

I don't want to scroll down and answer all questions and press finish.

I want to get question by question. For example, I answer question 1, press a button "next" and go to question 2. 

This will allow me to score and show the result question by question. 

 

I don't know if gallery is a the right tool to do this or if I need to proceed differently? 

Marna2022_1-1669043542388.png

 

Thank you !

 

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    Hi @Marna2022 ,

     

    I would probably generate a collection of questions in the App's OnStart property and use a form or individual controls to display the current question. Using a variable, initiated at a value of 1, you can navigate through the questions, using the Index function.

     

    Let's say you are using a form, you can select a question by setting the Item property to:

     

    Index(colQuestions, varSelectedQuestion)

     

    The variable can then be incremented as a result of the OnSelect property of the "Next" button and decreased for the "Previous" button.

     

     

  • Marna2022 Profile Picture
    30 on at

    @BCBuizer 

    Hi! Thank you for your answer. 

    I have been watching videos all morning trying to understand all what you explained in the solution. I created a collection with my "questions" database. However, I'm not sure how to use it. 

    But I kept going:)

     

    I'm stuck in this part: 

    1- I managed to get a question using label and the table directly from excel. 

    The name of the label is "Question1"

    Text property: First(Shuffle(Questions)).Question

    Marna2022_1-1669133688510.png

     

    Also, I did a variable as you recommended, 

     

    Button Next:

    On select property: Set(varQuestion,Question1)

    Marna2022_3-1669133828503.png

     

    And now, I don't know what to do. Navigate to another screen and add a second question? 

    Should I do 25 screens? or there is a more elegant way? 

     

    If you can give me just an idea, it would be highly appreciate it 🙂

     

    Best regards,

     

  • Verified answer
    BCBuizer Profile Picture
    22,510 Super User 2025 Season 2 on at

    Hi @Marna2022 ,

     

    If you add something like this to the OnStart property of the app, a collection will be generated with 25 random questions and a variable will be initiated:

    ForAll(
     Sequence(
     25,
     1
     ),
     Collect(
     colQuestions,
     Index(
     Shuffle(
     AddColumns(
     Questions,
     "Response",
     ""
     )
     ),
     ThisRecord.Value
     )
     )
    );
    Set(
     gblQuestionsIndex,
     1
    )

     

    In a single screen you can then add controls to navigate through the questions:

     

    BCBuizer_0-1669136587599.png

     

    In the above I set the below properties:

    Arrow1.OnSelect: Patch(colQuestions,Index(colQuestions,gblQuestionsIndex),{Response: Radio2.Selected.Value}); Set(gblQuestionsIndex,gblQuestionsIndex+1)
    
    Arrow1.DisplayMode: If(gblQuestionsIndex<25,DisplayMode.Edit,DisplayMode.Disabled)
    
    Arrow2.OnSelect: Patch(colQuestions,Index(colQuestions,gblQuestionsIndex),{Response: Radio2.Selected.Value}); Set(gblQuestionsIndex,gblQuestionsIndex-1)
    
    Arrow2.DisplayMode: If(gblQuestionsIndex>1,DisplayMode.Edit,DisplayMode.Disabled)
    
    Radio2.Items: Index(colQuestions,gblQuestionsIndex).Answers
    Radio2.Default: Index(colQuestions,gblQuestionsIndex).Response
    
    Label8.Text: Index(colQuestions,gblQuestionsIndex).Question

     

    This makes the Label show the question, the Radio show the possible answers and in case a an answer is selected, it is saved in the collection. When pressing the arrows, the user can navigate back and forth between the questions.

     

    Hope this helps.

  • Marna2022 Profile Picture
    30 on at

    @BCBuizer 

    Thank youuu!! It worked!! 

     

    Finally I can keep going! 

    I tried and had to do some modifications, and probably will spent part of my afternoon understanding why Onstart property! but thank you! 😄 😄 

     

    Have a great day!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard