Page tree
Skip to end of metadata
Go to start of metadata

The use of variables allows the creation of dynamic task text. Task content can be generated randomly or adapted to the user, previously given answers, or assessments. For implementation, two different types of variables are provided in the tab of the same name:

  • Pre-processed variables
    Pre-variables are assigned before the task is displayed and therefore make it possible to adapt the task text as well as the predefined and correct answers dynamically. In this way, task templates can be defined with the help of placeholders. These are replaced by specific random values per test run on the basis of defined intervals, value drop-down lists, or calculation rules. As a result, test tasks will be different but similar for each participant and test run.
  • Post-processed variables
    Post-variables are only assigned after the task has been answered, submitted, and automatically assessed, thus allowing access to response-specific values such as the learner's response or the points for correct answers. In this way, adaptive feedback content, follow-up tests, and task series can be enabled. The use of conditions and MAXIMA statements allows responses from learners to be analysed and typical errors identified. Based on these insights, teachers will then be able to provide appropriate feedback or customised exercises.

Tab Variablen

Pre-processed variables

Define variables that are determined before the task is displayed in order to use random parameters in your tasks. Variables are supported in ONYX for all types of tasks and offer various possibilities, especially for calculation interactions. With the help of variables, it is possible to create task templates which automatically allow an unlimited number of different test and exam attempts.

Variablen verwenden

For a typical application example for the use of variables as random parameters, see Example "Transport" - Use of random parameters.

Post-processed variables

Define variables that are determined after the submission of the task in order to create adaptive task and test scenarios. Post-processed variables (in short: post-variables) allow you to access the learners' answers and points achieved. You can use this information to enhance following content such as feedback or task descriptions of follow-up attempts. In addition, it is possible to intervene in the assessment and make subsequent changes to it.

Nutzerlösung einer Beispielaufgabe Nutzung einer Post-Variable im Feedback Nutzung einer Post-Variable Lösungshinweis


The following examples for the use of post-processed variables show possible application scenarios:

Definition of a variable

Click on Add new variable in the tab Variables to define a new variable. The new variable is immediately added and displayed in the overview table. Below the table, an edit window opens for the new variable. The order of the variables and conditions within the variables table can be easily changed using drag-and-drop.

Definition einer Variable im Editor

Assign a unique variable name for your variable. The variable name serves as an identifier and allows you to use the variable in the task text. Please make sure that the variable name does not contain any umlauts, special characters, and spaces. The input is case sensitive. If a variable is defined with the name "a", it can be accessed via the placeholder {a}.

Select the variable type. The following variable types are available:

Depending on the selected variable type, you have various options for the determination of the value:

  • Value
  • Value range
  • Random selection
  • Calculation (MAXIMA)

Variables can also be created without immediately setting a value. If the value is set at a later point in time, it can for example be set in dependence of other variables (cf. conditions).

Use of variables  

Defined variables can be inserted into task and answer text by specifying the variable name. Direct integration into LaTeX-formulas is also possible. The defined variable name must be enclosed in braces. ONYX automatically detects if there is a variable declaration with the appropriate name. If an identifier is used which is not defined, it will be ignored and output as text.

In the example, the variables {VAR1}, {VAR2}, and {VAR3} were declared:

Einfügen von Variablen in den Aufgabentext

Definition of a condition

In the tab Variables, you can also use conditions. A condition allows you to set the value of a variable, depending on other variable values.

Click on Add new condition to define a new condition. The new condition is immediately added and displayed in the overview table. Below the table, an edit window opens for the new condition. The order of the variables and conditions within the variables table can be easily changed using drag-and-drop.

Eine neue Bedingung anlegen

Variables can be compared with other variables of the same type or with fixed values. The comparison operators depend on the type of the variable. You can, for example, check whether values are equal to (=) or not equal to (!=) another value.

Vergleichsoperatoren einer Bedingung

Please note: A variable that is used within a condition must be initialised before the condition. The variable which is used in the condition or statement must be added as a single variable before the condition can be added. If the value of a variable is set within one or more conditions, it will be unnecessary to set a value for the variable itself. Select the empty entry from the value selection list.

Link conditions: If you have created several conditions for an IF section, you can configure how these entries will be linked. Determine whether all conditions (AND) or at least one condition (OR) must be met for the condition to be executed. 

Alternative conditions (ELSE IF): You can add any number of alternative conditions (ELSE IF branches). Different variables can be set in the conditions. In the simple mode, only one variable can be set per condition. For more complex rules, you can switch to the expert mode. A more detailed description can be found in the help pages for the expert mode.

Expert mode (IMS QTI)

The variable representation in the test and task content is based on the principle of template declaration and the template processing of the IMS QTI 2.1 specification. The template processing of IMS QTI 2.1 offers far more possibilities for setting variables, in particular by the nesting of logical expressions and conditions. The description entered in the expert mode is directly transferred into the XML of the task as a single template processing expression.

Variable im Expertenmodus

Please note that after changing the description in the expert mode, there is no way to return to the simple mode.

For further information on the XML definition of the template processing, please refer to the section IMS QTI 2.1 specification. The ONYX Testsuite already supports a wide set of IMS QTI expressions and possibilities. A detailed check to ensure correct functioning of the task template is nevertheless recommended when using the expert mode.

View variable assignment

When testing your test content, you can view the variable assignment in the preview at any time. These details are also available to the supervisor or assessor in the results views. In addition to the variable assignment, information on the MAXIMA tasks as well as possible system errors are displayed.

For more detailed information, please refer to the following help sections:

  • No labels