How to allocate users a score based on their answers to a question or series of questions: Difference between revisions
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
set anxiety2 to 50 | set anxiety2 to 50 | ||
</code> | </code> | ||
The logic above sets the emotions to 50 so if something is not saved, you will know about it when you look at your data (this is just an extra precaution). | |||
show page qp1 | show page qp1 | ||
<code> | |||
if (qp1.q1 = 0) set depress1 to 0 | if (qp1.q1 = 0) set depress1 to 0 | ||
if (qp1.q1 = 1) set depress1 to 1 | if (qp1.q1 = 1) set depress1 to 1 |
Revision as of 11:37, 19 August 2015
You can can use logic to calculate scores based on the responses users give to questions.
Example 1
In this example, users are asked to answer No, Sometimes, Regularly or Often to a series of questions, which are scored as 1, 2, 3 or 4 respectively.
set depress1 to 50
set depress2 to 50
set anxiety1 to 50
set anxiety2 to 50
The logic above sets the emotions to 50 so if something is not saved, you will know about it when you look at your data (this is just an extra precaution).
show page qp1
if (qp1.q1 = 0) set depress1 to 0
if (qp1.q1 = 1) set depress1 to 1
if (qp1.q1 = 2) set depress1 to 2
if (qp1.q1 = 3) set depress1 to 3
if (qp1.q1 = 4) set depress1 to 4
if (qp1.q2 = 0) set anxiety1 to 0
if (qp1.q2 = 1) set anxiety1 to 1
if (qp1.q2 = 2) set anxiety1 to 2
if (qp1.q2 = 3) set anxiety1 to 3
if (qp1.q2 = 4) set anxiety1 to 4
show page qp2
if (qp1.q1 = 0) set depress2 to 0
if (qp1.q1 = 1) set depress2 to 1
if (qp1.q1 = 2) set depress2 to 2
if (qp1.q1 = 3) set depress2 to 3
if (qp1.q1 = 4) set depress2 to 4
if (qp1.q2 = 0) set anxiety2 to 0
if (qp1.q2 = 1) set anxiety2 to 1
if (qp1.q2 = 2) set anxiety2 to 2
if (qp1.q2 = 3) set anxiety2 to 3
if (qp1.q2 = 4) set anxiety2 to 4
set depress_total to (sum(depress1, depress2))
set anxiety_total to (sum(anxiety1, anxiety2))
show questionnaire_feedback
set questionnaire_feedback.depress_score to depress_total
set questionnaire_feedback.anxiety_score to anxiety_total