In AskiaScript, a question variable is a question within the survey structure. The name of the variable is the question shortcut. See question type definition for more information.
The question variable is on the global scope, which means you can use it anywhere in your survey, even if the question has not been asked (e.g. it was skipped in this particular interview).
This kind of variable is state-full, which means that if you stop the current interview and go back to it later, the value of the variable is still there.
To access the question variable, you can use the shortcut of the question, using one of the following syntaxes:
| Syntax | Description |
|---|---|
| ??shortcut?? |
This syntax returns the value(s) (answers) of the question:
Examples:
??gender?? ' => 1 for Male
??age?? ' => 35
??brands?? ' => {3; 5; 7}
|
| %%shorcut%% |
This syntax returns the entry code(s) (answers) of the closed question:
Examples:
%%country%% ' => 4
%%brands%% ' => {4; 7; 1}
|
| shortcut |
This syntax returns a question object. This syntax is available if the shortcut:
If one of the above conditions is not reached, it is always possible to use the long form syntax by encapsulating the shortcut between hat characters (^): Examples: q1 gender gender_of_respondent ^1. gender of respondent^ |