cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jblackburnHWGA
New Member

Quiz question - scoring multiple checkboxes

I work in a school and I'm trying to make a quiz. Its a science one and one of the questions is

Which two organs are where digestion of food occurs?

I have 6 answers as checkboxes. How do i score multiple checkboxes?

So far i have 

If(Checkbox1.Value = true, Set(Score,1),Set(score,0)) 

I also want to add 1 to the score if checkbox1_5 is true.

 

The score,0 is to automatically set the score to 0 on a retake of the quiz.

 

I am mainly doing quizzes at the moment. If there is any help you can point me in the direction off it would be great. Even though i'm stuck the quiz part seems simple but i wanted a good finish page. Something that shows the overall mark and maybe which answers they gave incorrectly and what the correct answer was

 

I was hoping for a finish page that showed the score and 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@jblackburnHWGA 

There are a variety of ways to go about this.  The key will be how to make it manageable in some way.

I have done similar and found that having two labels in the app (doesn't make a difference where), one for correct answers and one for incorrect answers.

Now, let's say you have 6 checkboxes for your digestion question, two are correct and 4 are wrong.  I will call these Checkbox1 through Checkbox6.  Checkbox3 and Checkbox 5 are correct and the rest are wrong.

 

In the Correct Label you would have the following formula:

Sum(
    [Checkbox3.Value, Checkbox5.Value], 
    If(Value, 1, 0)
)

In the  incorrect label you would have:

Sum(
    [Checkbox1.Value, Checkbox2.Value, Checkbox4.Value, Checkbox6.Value], 
    If(Value, 1, 0)
)

 

Now that you have these labels, they will have the sum of all of the correct and incorrect answers.  You can refer to those labels anywhere you need to get the value - ex.  Value(labelCorrect.Text) would be the number of correct answers.

 

Anyway, this is just one of many ways.  This one I particularly like because it is relatively simple.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

1 REPLY 1
RandyHayes
Super User
Super User

@jblackburnHWGA 

There are a variety of ways to go about this.  The key will be how to make it manageable in some way.

I have done similar and found that having two labels in the app (doesn't make a difference where), one for correct answers and one for incorrect answers.

Now, let's say you have 6 checkboxes for your digestion question, two are correct and 4 are wrong.  I will call these Checkbox1 through Checkbox6.  Checkbox3 and Checkbox 5 are correct and the rest are wrong.

 

In the Correct Label you would have the following formula:

Sum(
    [Checkbox3.Value, Checkbox5.Value], 
    If(Value, 1, 0)
)

In the  incorrect label you would have:

Sum(
    [Checkbox1.Value, Checkbox2.Value, Checkbox4.Value, Checkbox6.Value], 
    If(Value, 1, 0)
)

 

Now that you have these labels, they will have the sum of all of the correct and incorrect answers.  You can refer to those labels anywhere you need to get the value - ex.  Value(labelCorrect.Text) would be the number of correct answers.

 

Anyway, this is just one of many ways.  This one I particularly like because it is relatively simple.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,575)