A computed question is not asked; instead, its value or response is computed from a formula which uses other questions, constants and system variables. Its value is intended for later use. Its possible applications are:
An argument in a later skip condition.
Insertion in the long label of a later question (using < >).
Data to be extracted to some external data file.
Selection of a choice in the computed question itself. This choice may then contribute to quota fulfillment, choice elimination, or recalls.
Note: A question used in a formula must be numeric i.e. it must bear a $R or $E mask, and it must not have choice categories.
You create a computed question exactly as you do a regular question, however you specify an IF Condition for a complex skip whose destination must be an asterisk (*), which means: skip to next question in any case. You then enter a computation formula rather than a skip condition, the syntax rules of which are the same.
Example 1
Suppose that we have the following two questions, Q23A and Q23B, asking for the quantity and frequency of consumption of some XYZ product:
Q23A: |
How much XYZ do you drink ? |
mask: |
$E |
|
|
Q23B: |
Note the frequency |
choices: |
01 Daily |
|
02 Weekly |
|
03 Monthly |
|
04 Yearly |
Suppose now that we would like to express the combined response to these two questions in terms of annual consumption. We create question Q23C and perform the calculation:
Q23C: |
Yearly consumption of product XYZ |
if |
Q23A *(V01(Q2B=01)*365+ V01(Q2B=02)*52+V01(Q2B=03)*12+V01(Q2B=04)) |
|
|
skip to * |
|
Example 2
A computed question which does not have response choices can only have a value. However, if it does have numeric choice codes, the system will look for a match between its computed value and one of its own choice codes. If a choice code matches the computed value, it will be selected.
Suppose that we have a question Q1 with two choices: Yes, No. and that we would later like to recall the text 'Accepted' or 'Refused' respectively. We create question Q2 and perform the selection.
Q1: |
Do you agree? |
choices:: |
1 Yes |
|
2 No |
|
|
Q2: |
Selection of choice |
if |
IF ((Q1=1),1,2) |
skip to * |
|
choices: |
1 accepted |
|
2 refused |
Later on in another question we could recall Q2 for insertion in its long label. Example:'Since you have <Q2> our offer...'