Skip Navigation

Variables

What are Variables?

Variables are user-defined parts of a comment bank that store a value. They function similarly to a $text field, however typing in a value once allows it to be reused through a comment bank.

Variables Versus Fields

Let's say I am creating a comment bank to update feedback on a unit test. I could create a comment bank using fields or variables. Let's see the difference.

Using Fields

I'm going to create a narrative comment that allows me to select how the student did on their retest, using fields to hold values:

Insert: Tools:

When generating reports, I would see this input:


The disadvantage of this approach is that if you click the reset button in between students, you have to renter the quiz. You will also have to renter the quiz between students if you select different levels. Using variables can help you save time in a situation such as this.

Using Variables

Defining Variables

To use a variable, you will need to start by defining it. To do so, start by opening the comment bank where you would like to use the variable. At the very top of the page, click the button. A window will open that will allow you to name variables, and set a default value if desired.

Naming Variables

Variable names must start with a $ and can only contain letters. Numbers, spaces and symbols will be removed from their name. Make sure not to name variables the same thing as each other, or as a placeholder that already exists. That means I should not name my variable $student, for example.

Setting Default Values

Optionally, I can set default values for each variable. These default values will be used if no input is entered on the generator.

Variable Limits

Each comment bank can have up to 10 variables defined at one time.

Example

If I'm trying to recreate the example above, I could enter the following variables:

Variable Default Value

Using Variables

After you have defined it, to use a variable in a comment bank, all you need to do is type its name. In this example, all I need to do is use $quiz or $retakeUntil. The comment editor will show that it recognizes a variable by highlighting it in orange. If a variable name is misspelled or not yet defined, it will be underlined in orange instead. For example, if I used the variable $test instead of $quiz I would see this. You can also add variables by clicking on the button. I can now modify the comment I made earlier using those variables like this:


Insert: Insert Variable Tools:

When generating reports, I would see this input:

Setting Variable Values:

Now when generating reports, I only need to set the value of the variables once. At the top of the generator, I will see this:


Entering values in this will then update all of the places the variable appears throughout the comment bank. These values also won't be reset when I click the "reset" button or change classes.

Try it Out

Want to explore how this works? Try it out yourself.