Skip to main content
The syntax is simple: wrap the variable name in double curly braces: {{variableName}} Before using the examples, create the referenced variables in the Variables pane. Use Set Variable actions to assign their values before the display action: choose Set Value for a literal value or Set Expression for a calculation. Enter Set Expression formulas without {{ }}. In the examples, Variable: score = 95 describes the value to assign. Select score in Set Variable and enter 95 as its value; do not enter the entire assignment as an expression. Display text examples use the Body field unless Title is specified.

Basic Syntax

When this text is displayed:
  • {{userName}} is replaced with the value of the userName variable
  • {{score}} is replaced with the value of the score variable
Example:
  • If userName = "John" and score = 95
  • The text becomes: "Hello John, you scored 95 points."

Common Uses

Interpolation is supported in the Title and Body fields of Show Text and Show Panel. Verify other fields in the target client before relying on it there. Here are the most common uses:

Show Text Action

Show Panel Title and Body

Feedback Messages

All Variable Types

Interpolation works with all variable types:

String Variables

Number Variables

Boolean Variables

Note: Booleans display as “true” or “false”. For user-friendly text, use a ternary expression (see below).

Array Variables

Arrays can interpolate directly as comma-separated text. For example, {{completedSteps}} displays Read Instructions,Identify Valve,Turn Valve. Use len() when you need the item count. To display one item, use its index in square brackets. Indexing starts at 0, so scores[0] is the first item and scores[1] is the second:

Advanced: Using Expressions in Interpolation

In addition to simple variable names, you can use Altoura Expression Language (AXL) expressions inside {{ }}. Interpolation reads values and computes display text without changing stored variables. Use Set Variable to save a calculated result.

Ternary Expressions (If-Then-Else)

Formula: condition ? valueIfTrue : valueIfFalse Another example:

Arithmetic

Function Calls

Available functions: For example, check whether a step is in a list:
For filter, put the predicate in quotes. Within it, item is the current element and index is its position, starting at 0. The predicate can reference other variables and must return true or false. JavaScript arrow functions are not supported.
Using concat or filter in display text leaves the original array unchanged. To update a list, select the array in Set Variable and use Set Expression, such as concat(completedSteps, ['step3']).

String Concatenation

Undefined Variables: Default Behavior

What happens if you try to interpolate a variable that doesn’t exist or is uninitialized?
An undefined value displays as --. An existing empty String displays as empty text. An expression evaluation failure displays [Error]. To avoid this:
  • Create variables before referencing them and use Set Variable for the values the text needs.
  • For an existing String variable, use a ternary expression to provide fallback text when its value is empty:
This fallback handles an empty String; create userName before using it.

Real-World Examples

Quiz Feedback

Set score, maxScore, and userName first. Then select the String variable feedbackLevel in Set Variable and use Set Expression with score >= 80 ? 'great' : 'okay' before the display action.

Personalized Status Message

Time-Based Messaging

Conditional Content

Set passScore and actualScore first, then calculate the String variable feedbackURL with Set Expression before displaying it.

Where Interpolation Works

Interpolation is available in: Where it doesn’t work:
  • Variable names and fields in the Variables pane
  • Condition expressions and Set Expression formulas (use variables directly, without {{ }})

Testing Interpolation

Use Set Variable actions before the display action, then save and start Preview to check the resulting text.
  1. Create a String variable named userName.
  2. Add Set Variable before Show Text. Select userName and use Set Value to enter Alice.
  3. Set Show Text’s Body to Hello {{userName}}, welcome!.
  4. Save and start Preview. Confirm that the text reads Hello Alice, welcome!.
  5. Exit Preview, change the Set Variable value to Bob, and save.
  6. Start Preview again and confirm that the text reads Hello Bob, welcome!.
The Variables pane manages variable definitions; it is not a live runtime-value editor. Set starting values through Set Variable actions and restart Preview to test edits.

Best Practices

Avoid overly complex expressions in {{ }}. If it’s hard to read, it’s hard to maintain. Consider breaking complex logic into separate variables.
Create each variable and use Set Variable to assign the value your text needs before displaying it. A new String starts empty; use a ternary expression when empty text needs a friendly fallback.
Use a ternary expression such as {{score >= 80 ? 'Passed' : 'Try again'}} to choose the text displayed by one action.
If you use userName in some places and learnerName elsewhere, you’ll confuse yourself. Pick a naming convention and stick with it.
Preview your training with actual variable values to make sure the interpolated text looks good and reads naturally.
Even if score = 92, consider displaying “Great job!” instead of just the number. Use ternary expressions to show friendly feedback.

Common Mistakes

Forgetting quotes in expressions: If you use a string value in a ternary, add quotes: {{actualValue == 'correct' ? 'You got it!' : 'Try again'}}
Leaving uninitialized variables: If you interpolate a variable you forgot to create, it displays as --. Always create and initialize variables first.
Using interpolation in conditions: Conditions use variables directly, not interpolation. Use score >= 80, not {{score}} >= 80.

Next Steps

Learn more about: