How to count correct Answers

0
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?
asked
2 answers
1

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

answered
0

Assuming the questions/answers are just attributes in your domain model….

  1. Create a microflow, ACT_ScoreTest
  2. First action, create an integer value “Score” – set the value to 0
  3. For every question, create this kind of split

    In your split, compare their answer to the expected answer
  4. On “True” (i.e the answer is correct), change your score like so
    $Score+1
  5. On “false”, just merge back and continue, you don’t increase the score because the answer is wrong
  6. 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 :) 

answered