Forum Discussion
The Value of Variables
Variables provide the real power in Storyline. Simply put, a variable stores data. That data can help you track selections, control interactions, perform calculations, and so much more.
Types of variables
Based on the type of data it holds, a variable belongs to one of three categories.
True/False variable
A True/False (T/F) variable is like an Open/Closed sign that hangs in a storefront's window. There are only two possible options. The value of a T/F variable can only be True or False.
Text variable
A Text variable is like a written note. Its value can contain any combination of keyboard characters.
-
- It is possible to enter a number into a Text variable. However, the program will see the value as typed characters, not as a number. Therefore, you can't do math operations on a number in a Text variable.
Number variable
A Number variable is like an entry in a calculator. Because the value can only be numeric, the program can perform math operations on it. Here's more info about calculations: PRIMER: Trigger calculations in Storyline | Articulate - Community
Variables can also be categorized as follows:
- Project variables are created within a given .story file.
- Many Project variables are created manually. However, when you insert a data-entry field (text entry or numeric entry), Storyline automatically creates the appropriate type of variable to hold the value entered in the field.
- Built-in variables are used for values that might apply to any course. For example, there are built-in variables to control accessibility features, to number slides, and to report quiz results.
Variable values
The data stored in a variable is known as the variable's value.
- Each variable starts with a default value.
- A value stays the same until a trigger adjusts it.
- A value can be displayed and used in triggers anywhere in the course.
Creating and accessing variables
You can create or edit variables in the Variables window.
The button to open the Variables window is near the top of the Triggers panel.
The Variables window has separate buttons at the top for showing either the Project variables or the Built-In variables. It also displays each variable's Name, Type, Default Value, and Use Count.
- You can edit a variable's Name or Default Value.
- Clicking the number in the Use Count column opens a window that shows were the variable is used in the course.
- You cannot edit a variable's Type. Instead, you have to create a new variable with the desired type.
Displaying variable values
To display the value of a variable as text on the slide, you can type the name of the variable within percentage signs. For example, to display a variable called "Name," type "%Name%" where the variable should be shown.
You can also insert a reference to the variable from the INSERT ribbon.
While editing a slide, a variable reference will be highlighted in yellow. This makes it easy to see where text will show a variable's value. That highlighting will not appear when the slide is previewed or published.
Tips for working with variables
- When you create a variable, Storyline gives it a generic name (such as “Variable1,” “TextEntry,” or “NumericEntry”). To make development and troubleshooting easier, give every variable a new, meaningful name.
- It can help to display variable values during development. That allows you to check whether the values change when expected. If the user doesn’t need to see a value, insert the reference into its own text box. Then move that text box off the slide, hide it, or delete it before publishing the course.
- A trigger can be set to run when a variable changes. However, that kind of trigger only works when the variable changes on the same slide as the trigger.
It's worth the effort to learn about variables.
These links lead to more info.
- Storyline 360: Working with Variables | Articulate - Community
- Info about Built-In Variables
- PRIMER: Trigger calculations in Storyline | Articulate - Community
- On-demand training: Getting Started with Variables
- On-demand training: Using True/False Variables
- On-demand training: Using Text Variables
- On-demand training: Using Number Variables
- JudyNolletSuper Hero
I also recommend Walt Hamilton's post about variables: What are variables and how (and why) should I use them? | Articulate - Community
- AngeCommunity Member
Fantastic as always. I miss community member portfolios, no longer available with the revamped site, where you (and many other members) had generously shared and collated your tips, tricks, troubleshooting, step-by-step, best practice, advice, examples and so much more. Thank you.
- JudyNolletSuper Hero
Thanks for the kind words, Ange!
FYI: When you go to someone's profile page, it defaults to the "Most Recent" tab, which lists their most recent activity on the site. If you switch to the "Newest Topics" tab, you'll see a list of the posts that person has authored. So if you ever want to review the tips I've posted, that's where to look. 😁
Yeah, that's not as nice as the way profile pages were set up on the old site. I've already submitted a feature request that they should, at the very least, change the tab names. Because "Most Recent" and "Newest Topics" sound like the same thing...
Hi, Judy!
This is an excellent post🤩 Thanks for sharing with the community!
- JoeFrancisCommunity Member
Well said, Judy, as always! Now, if we could just convince the powers-that-be at Articulate to add the array (list)-type variable and the object-type variable, that would open so many more doors.