How to count correct Answers
Hii All, Am creating an app where a user can attained a test, Now i want to count the number of correct answer and show it to the user. How can i do this?
The question is, when do you want to display the information and how you are storing the information?
If you count the information on an object, then you can create microflow and to a retreive by xpath related to the user and then add a count action on them. Good luck
Assuming the questions/answers are just attributes in your domain model….
- Create a microflow, ACT_ScoreTest
- First action, create an integer value “Score” – set the value to 0
- For every question, create this kind of split
In your split, compare their answer to the expected answer
- On “True” (i.e the answer is correct), change your score like so
- On “false”, just merge back and continue, you don’t increase the score because the answer is wrong
- Return Score from the micrflow, and display it however you like!
This is a really quick answer under the assumption the whole test is in one entity/object. Lists/dynamic tests would be a different matter. Hope this helps :)