Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Sometimes it can be useful to create a tally of the response to a series of questions. For example, some simple diagnostics tools tally responses to generate a preliminary diagnosis. The  The easiest way to do this is to set the item values to a numeric value.  For   For example, if you have the question: " How  How do you feel today?" The choices could be coded as:

0- Excellent

1- Fair

2- Sick

In this case, maybe a higher score on several different questions could trigger the need to referral. You  You would create a hidden value (i.e. #form/data/total_score) that sums the value of all the relevant questions. This will result in a numeric value.

A second hidden value (i.e. #form/data/preliminary_diagnosis) could help to interpret these values by using nested if statements to set the value of preliminary_diagnosis. For example, the calculation could read:

if(#form/data/total_score > 14, "high_risk", if(#form/data/total_score > 9, "monitor", "okay"))

...