Variables

Environmental variables

Sometimes it is not enough to hard code behaviors into your tasks, sometimes you want behavior to depend on a previous response, or change some texts according to randomization. In order to achieve these behaviors you can use variables.

We will first describe variables that are common across all tasks, and are always available - these are the global and current variables. Then we will get down to variables variables that are available only in specific contexts - such as the data and meta variables.

Accessing variables

There are many ways to use variables within the PI tasks. You can learn about them in their respective documentation, check out conditions and templates. In addition, some of the variables can be accessed directly from your JavaScript, in cases that this is possible it will be mentioned in the description of the variable.


Current

Serves as the context or state of the currently running task.

Global

The global variable serves as the state of your whole study.

Local

data and meta are variables specific to the scope of specific elements.

Last modified March 11, 2021: setup hugo (11980dc)