Skip to main content

The 4 Variable Types

String

Text values (words, sentences, single letters)

Number

Numeric values (integers and decimals)

Boolean

True or false only

Array

A list of values (ordered collection)
Variables pane showing an expanded Score variable with Type set to number and an empty Description field

Expanded Number variable with the Type dropdown and optional Description field

To create a variable, click Add Variable and choose String, Number, Boolean, or Array from the menu. The variable card provides Name, Type, and Description fields; String variables also provide Pattern (Regex). Use the card’s Type dropdown to change an existing variable’s type. New variables start at the type defaults below; use Set Variable actions for other initial values. Existing stored defaults are preserved when the type is unchanged. Create each variable before using it in an action or condition. In Set Variable, select the variable, then choose Set Value for a literal value or Set Expression for a calculation. Enter only the calculation in Set Expression, such as score + 10, without an assignment or {{ }}.
Transition conditions must evaluate to true for the transition to run. Choose the destination step separately from the condition. Assign any values the condition needs before the event that checks it; the same transition’s Actions run only after its condition passes.

String

What it is: Text values — words, sentences, single characters, or any string of characters. Default value: "" (empty string) for a new variable. Use Set Variable to assign other text. Examples:
  • "correct" (single word)
  • "John Smith" (multiple words)
  • "Safety-Procedure-001" (identifier with special characters)
  • "The valve is open." (sentence)
  • "" (empty)
When to use:
  • Store the learner’s name, username, or email
  • Store selected answers (“Option A”, “Door B”)
  • Store status values (“open”, “closed”, “waiting”)
  • Store IDs or codes
Example variable:
To record an Option A choice, configure a Set Variable action in the training logic that handles that choice:
On a later transition, use selectedAnswer == "Option A" as the condition and select the appropriate destination step. Using strings in conditions:

Number

What it is: Numeric values — integers (whole numbers) or decimals (numbers with a point). Default value: 0 for a new variable. Use Set Variable to assign another starting number. Examples:
  • 0, 1, 100 (integers)
  • 3.14, 0.5, 99.99 (decimals)
  • -10 (negative)
When to use:
  • Store scores or points
  • Store attempt counts
  • Store time values (in seconds or milliseconds)
  • Store percentages or ratings
  • Store object positions or angles
Example variables and actions: Create Number variables score, attempts, startTime, and elapsedSeconds. Each starts at 0. Configure Set Variable actions as follows: now() returns a timestamp in milliseconds. Capture startTime when timing begins and keep it unchanged until the measurement is complete. Dividing the difference by 1000 gives seconds. elapsedSeconds updates whenever its Set Variable action runs. Using numbers in conditions:

Boolean

What it is: A value that is either true or false — nothing else. Default value: false for a new variable. Use Set Variable to initialize true when required. Examples:
  • true (yes, complete, open, on)
  • false (no, incomplete, closed, off)
When to use:
  • Track yes/no states (is something complete? is it open?)
  • Track toggles (is audio enabled? is advanced mode on?)
  • Track completion of required tasks (has the inspection been completed?)
  • Status flags (is this section unlocked?)
Example variables: Create these as Boolean variables. Each starts at false: For example, add this Set Variable action to the transition that records successful completion of the inspection:
A flag stores a value. Configure the actions that update it and the conditions that use it in your training flow. Using booleans in conditions:
Booleans are simple and fast. Use them for simple on/off states instead of strings like “complete”/“incomplete”.

Array

What it is: An ordered list of values. Access items using an index starting at 0: completedSteps[0] is the first item, and completedSteps[1] is the second. Default value: [] (empty array) for a new variable. Use Set Value with a JSON array to assign a list, or Set Expression to calculate an updated list. Examples:
When to use:
  • Store a list of items (completed steps, selected choices)
  • Store a history (previous scores, timestamps)
  • Track multiple related values in order
Example variable:
Add an entry after the trainee completes the corresponding task. For example, on the transition that records successful completion of Identify valve, add:
With an initially empty list, this stores ["Identify valve"]. Add each task only once when using the list length as a count of distinct completed tasks. Use len(completedSteps) >= 3 as a condition to check whether at least three tasks have been recorded. For a training with five tasks, display progress in a Show Text or Show Panel Body:
Using arrays in conditions:

Choosing the Right Type: Quick Reference

Use this table to decide which type to use:

Type Compatibility

Use matching types when comparing values and assigning a result with Set Variable. A Number variable requires a numeric result, a Boolean requires true or false, and an Array requires an array.
The + operator adds numbers or joins text. The == operator can compare different types by converting them during comparison; === also requires matching types: len() returns the length of a string or array. clamp() requires numeric arguments and constrains a number. Neither function converts numeric text into a number. Choose Number variables and numeric values for arithmetic.
A ternary expression can choose text for interpolation, such as {{score >= 80 ? 'Passed' : 'Try again'}}. For a transition condition, use a Boolean expression such as score >= 80.

Starting Values

Creator assigns these defaults to new variables automatically: The Variables pane does not expose an editable Default Value field. For another starting value, add a Set Variable action in the starting step before actions that read it. For example, create a Number variable passingScore, then select it in Set Variable and use Set Value to enter 80. Changing a variable’s Type resets its default to the new type’s default. Review actions and conditions that use the variable after a type change. Existing stored defaults are preserved when the type stays the same.

Best Practices

Changing types later can break conditions and actions. Plan ahead.
Strings, numbers, and booleans are easier to work with than arrays. Use them unless you really need a list.
Instead of answer1, answer2, answer3, use one selectedAnswers array.
Review the automatic defaults and use Set Variable for other starting values. Initialize each value before actions or events that depend on it.

Next Steps

Learn about: