Adding Text Variables
One of the most common examples for text variables is used to capture a learner's name and then reference that name during and at the end of the course--often in the form of a course completion certificate
View the published example | Download the source file
Begin by previewing the final, published example. On the first slide, you're asked for your name. Type your name and click the Next button. On the second slide, the name you entered appears in the certificate. Pretty cool, right? Let's take a closer look at how we put this together.
Step 1: Insert a New Text-Entry Field
- Go to Insert > Data Entry > Text Entry
- Place your cursor over the name tag. Then click and drag to create a text entry box.
- Center the text by clicking the Paragraph style
You just created your first variable. Take a look at the Triggers panel and you'll see a new trigger along with a variable. Storyline created a variable named TextEntry for us when we inserted the text entry field. This variable can be used at any point in our project to reference the text-based value.
Let's edit our variable name to give it something more specific to how we're using it.
Step 2: Edit the Variable Name
- In the Triggers panel, click the X in the bottom right corner. This opens the Project Variables window.
- Double click the TextEntry name.
- In the Variable window, type a new name: FirstName.
- Leave Value blank and click OK.
Take a look in the Triggers panel. You'll see that Storyline has updated our trigger to reference the updated variable name.
That's it for creating and editing variables. At this point, we've created a variable that will accept text-based data from our learner. But storing data is only half the fun--we can also retrieve the data.
Step 3: Insert a Reference to the Variable
Now that our variable is set and ready to take data, we need a way to retrieve and display that data. To display the data, we insert a reference to the variable.
- Select the second slide "1.2 Congratulations."
- Go to Insert > Text Box and drag out a text box in the middle of the certificate.
- Next, go to Insert > Reference to bring up the variable references. The FirstName variable is selected because it's the only variable.
- Click OK to insert a reference on the slide.
The formatting for reference variables is always the same:
Step 4: Format the Reference Variable Using the Font Tools
Finally, we can apply some basic formatting to our reference variable to align it with the rest of our slide design.
- Select the reference variable text box
- Increase the font size to 28
- Center the text using
Preview your project by pressing F12
Now try clicking the Previous button to return to the first slide. Enter a new name and click Next. Storyline automatically updates the variable with the latest value. That's because variables can only hold one piece of data at a time.