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 easiest way to do this is to set the item values to a numeric value. For example, if you have the question: " How do you feel today?" The choices could be coded as:
In this case, maybe a higher score on several different questions could trigger the need to referral. You would create a hidden value (i.e. #form/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/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/total_score > 14, "high_risk", if(#form/total_score > 9, "monitor", "okay"))
You could also use the output of either total_score or preliminary_diagnosis to determine the display condition for relevant questions or labels.
This becomes more complicated if a question has to be coded with something other than numbers for item values, or if there are two possible answers that have the same numeric value. In these cases, the checklistand weighted checklist functions are really useful.
If your scoring is too complex even for these functions, you will need to create a hidden value that corresponds to each question and interprets the answers as a numeric value.