So basically I have a quiz with 38 questions, every question is in different pages so I have 1 welcome page, 38 question pages, 1 to save colors and to play the timer (user never access this) and 1 last page that tells the user their score.
The way the apps calculates the score is with a variable called 'Score', when the correct answer is selected (in a Radio input) and then the user clicks the 'Next' button, this button adds 1 to the variable, if the user doesn't select the correct answer it doesn't add nothing and just navigates to the next question:
If(
Answers_2.Selected.Value = "The Product Owner.",
Set(
Score,
Score + 1
)
);
Navigate(Question_3)
My problem is that this works only in the first 6 questions, when you try to answer the question in question 7 to question 38 it doesn't add anything, even if you select the correct answer and I don't know why. I've been trying to figure this out for like 5 hours but I just don't understand why it doesn't work.
Solved! Go to Solution.
Hi @ElMigol ,
Based on your description, it seems there is no problem with the text value used for comparison. To be honest, I can't find the reason why your formula doesn't work at the moment.
In addition, I have an idea for tallying scores, but it may take you some time, so try it if you're interested.
1. When the correct answer is selected and then the user clicks the 'Next' button, this button will add a record to the collection.
2. The last record in the collection will be deleted if the user needs to navigate to the previous question.
3. Use the CountRows() function on the last screen to count the scores.
If(
Answers_1.Selected.Value = "A",
Collect(AnswersCollection,{page:"Q1",result:"true"})
);
Navigate(Question_2)
RemoveIf(AnswersCollection,page="Q1");Navigate(Question_1)
"Score: "&CountRows(AnswersCollection)
Hope it can be helpful to you.
Best Regards,
Charlie Choi
There is no reason it would not work on other screens. However, what is significant in your formula is that you are comparing text. In that case, the text MUST be an exact match (letter case, punctuation, etc.). So, if there is any difference, your score variable will not get updated.
You might consider being a little more loose with the formula.
Ex:
If(
StartsWith(Answers_2.Selected.Value, "The Product Owner"),
Set(
Score,
Score + 1
)
);
Navigate(Question_3)
The above would ignore letter case and the punctuation is omitted.
If this is not helpful, then post the formula from your screen that is not working. The one you posted implies that it is on what would potentially be question number 3...you stated that question 6 and on have issues.
I hope this is helpful for you.
The only think that I am thinking of is "about the self reference".. In Power automate you can not do that for example.
What you can try:
If(
Answers_2.Selected.Value = "The Product Owner.",
Set(QuestionScored, Score);
Set(
Score,
QuestionScored + 1
)
);
Navigate(Question_3)
So, you create a new var to save the "new" score and after that add 1 to get the global
If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!
Best regards,
Gonçalo Nogueira
Check my LinkedIn!
Buy me a coffee!
Check my User Group (pt-PT)!
Last Post on Community
My website!
Thank you for you reply! I'm pretty sure that the text comparison is fine since every text line is copied and pasted from a Microsoft Form that my boss sent to me. Either way I tried replacing my code with yours but still it doesn't work. So this is my code for the button on question 7:
If(
Answers_7.Selected.Value="15 minutes",
Set(
Score,
Score + 1
)
);
Navigate(Question_8)
As you can see it's literally the same for every single button, that's why I can figure out why it doesn't work.
Thank you for your reply!
If this was Power Automate it would make sense but I'm working on Power Apps. Even if that was the case, this doesn't work only from question 7 to question 38, from question 1 to question 6 it works perfectly fine. Either way I tried you code but it still doesn't work.
Yes, so again, the formula is syntactically correct, so the comparison is not seeming to happen.
Once you get to the point of clicking on that next button, instead look in your formula and highlight the Answers_7.Selected.Value part of the formula and see what the formula editor is telling you that the value is. Compare that to what you are comparing to in the text in the formula...is it the same?
Yes, it is the same.
Hi @ElMigol ,
Based on your description, it seems there is no problem with the text value used for comparison. To be honest, I can't find the reason why your formula doesn't work at the moment.
In addition, I have an idea for tallying scores, but it may take you some time, so try it if you're interested.
1. When the correct answer is selected and then the user clicks the 'Next' button, this button will add a record to the collection.
2. The last record in the collection will be deleted if the user needs to navigate to the previous question.
3. Use the CountRows() function on the last screen to count the scores.
If(
Answers_1.Selected.Value = "A",
Collect(AnswersCollection,{page:"Q1",result:"true"})
);
Navigate(Question_2)
RemoveIf(AnswersCollection,page="Q1");Navigate(Question_1)
"Score: "&CountRows(AnswersCollection)
Hope it can be helpful to you.
Best Regards,
Charlie Choi
It looks to me that Your condition is either not meet or you are referring to the wrong Radio control ... You are sure that all that is right ?
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
181 | |
52 | |
41 | |
39 | |
33 |
User | Count |
---|---|
262 | |
81 | |
71 | |
69 | |
66 |