Skip to main content
Collection Variables

How to use Collection Variables.

Trevor Register avatar
Written by Trevor Register
Updated over a week ago


Collection Variables allow for quick and efficient randomization within activities that help create a variety of student experiences as well as preserve academic integrity. Instead of being restrained to just one numerical value, Collection Variables can contain a mixture of numerical, text, and uploaded image values. Collection variables can also be used to load specific trials of Pivot Interactives videos for students and restrict their view to only that trial.

What are Collection Variables?

Consider the following physics word problem aimed at assessing a student's understanding of determining the direction of acceleration:

A student pushes a ball that is moving to the right causing it to slow down. Is the acceleration positive or negative?

The phrases "moving to the right" and "slow down" could be interchanged with other possibilities such that the question assesses the same thing without a change in difficulty. There are 4 different cases that students could be asked about with different correct and incorrect answers for each:



Speed change





Speed up





Slow down





Speed up





Slow down



Collection Variables can also be used with Pivot Interactives videos that have multiple parameters and trials to randomly assign students a particular scenario.

The experiment above has 5 spring stretches for each of the different cart mass values allowing for up to 20 different combinations of the two.

Cart Mass

Spring Stretch













Collection Variables allow you to encapsulate a collection of scenarios into a single variable, randomly assign a student a specific scenario, and then have their response automatically graded and given feedback based on their assigned scenario.

Creating a Collection Variable

  1. Click Edit Variables to open the Variables window.

  2. Change Variable Type to Collection.

  3. Name the variable

  4. Input the number of rows and columns (this can be changed later, too)

  5. Enter a description of the variable. This description is visible only to you while you're in edit mode.

When you click Create, that will bring up another window where you can provide all the names and parameters for your Collection Variable.

  1. Type a label for each column

  2. Click to change the type of each column to text, number, or image.

  3. Type in the values

  4. Save your work

  5. Add or delete rows/columns.

Here's how a Collection Variable called acceleration_case would look for the acceleration question above.

When this Collection Variable is used in an activity, a student would be randomly assigned 1 of the 4 possible scenarios. So if a student was assigned scenario 3, the direction, change, correct, and incorrect variables for them would be left, slow down, positive, and negative, respectively.

Using Collection Variables

Here are two examples of using Collection Variables:

A simple word problem

The original question is: A student pushes a ball that is moving to the right causing it to slow down. Is the acceleration positive or negative?

We'll add that to the Prompt of a Multiple Choice Question, but instead of moving to the right or slow down, we'll use a collection variable scenario.

  1. Click $ to open the Variables window.

  2. Click the Collection Variable.

  3. Click the attribute scenario you'd like to insert.

  4. Click to insert

The full question would then look like this:

For the answer choices, use $[acceleration_case.correct] and $[acceleration_case.incorrect]. Consider checking the Randomize Choice Order box, especially when there are a small number of choices.

In this example, a student was assigned scenario 4, so the correct answer would be negative.

However, this student was assigned scenario 1, so negative is incorrect.

Assigning Experiment Parameters

The Spring Shot experiment has 4 different cart masses that are each pulled back on a spring by 5 different stretches, leaving up to 20 different combinations of cart mass and spring stretch values.

Creating a Collection Variable for this experiment allows students to be randomly assigned 1 of these 20 different scenarios. We've used the stretch column so that students can be told which Spring Stretch trial to choose, which is separate from the actual number of centimeters that the spring is stretched by (stretch_amount). Only the first 7 scenarios are shown below.

The first question simply asks the student to measure the spring stretch. Because the Collection Variable has stretch_amount as an attribute, this allows you to use $spring_trial.stretch_amount variable as the answer formula in a numerical question to determine whether or not the student has made the correct measurement.

In the example below, a student is assigned the scenario where the cart mass is 802 g and spring stretch 3.

Images and Collection Variables

Consider a scenario where you'd like to give students an image of a velocity graph and have them answer the following questions:

  1. Calculate the displacement.

  2. Calculate the acceleration.

  3. Calculate the velocity at some time t.

  4. What is the direction of motion?

  5. Is the object speeding up or slowing down?

This could be done without a collection variable. But with a collection variable, you can add many different scenarios that are randomly assigned to each student. Here's the structure of the collection variable you could use to set this up with just two velocity graphs, but you could do so many more! Click any of the images below to enlarge them.

Here's how to set up the questions:

  1. Add a Numbered Instruction component with the following text:

  2. Add a Numerical Question component with the appropriate answer formula. Note: the full answer formula is $velocity_graphs.displacement.

  3. Do the same for calculating the acceleration, except the answer formula would be $velocity_graphs.acceleration.

  4. Define a new Random Number Variable (we'll call it $vt_graph_time), then create another Numerical Question component. Note: The full answer formula is: $vt_graph_time*$velocity_graphs.acceleration

  5. Create a Multiple Choice Question component:

  6. Do the same for the speeding up or slowing down question, except use [$velocity_graphs.speedChangeCorrect] as the correct answer formula and [$velocity_graphs.speedChangeIncorrect] as the incorrect one.

Note that for multiple choice questions written like this, you should always check the Randomize Choice Order box. Otherwise, the first option will always be the correct one.

Copy+Paste from a spreadsheet

You can copy and paste data for a collection variable from a spreadsheet into the collection variable window. There are specific rules that must be followed for this to work:

  • This can only be used to copy numbers and text. Images must still be uploaded manually.

  • Make sure that numbers are formatted as numbers in the spreadsheet, not text (Formatting numbers in Excel, Google Sheets). If formatted as text, a conversion to a number is attempted. If that fails, the value defaults to 0 in the Collection Variable.

  • The selected area in the spreadsheet you're copying from must have the same number of rows and columns as the collection variable.

  • Only data can be pasted. Column names in the collection variable must be typed manually.

Did this answer your question?