Skip to content

Canvas Advanced String Variables

Nicolas Ronvel edited this page Jun 19, 2016 · 5 revisions

Advanced String Variables

To get the value of a text field on the card, we can use the simple Text Variable. But sometimes, a more complex value is needed. For example, concatenating two strings.

Some fields also propose different types of values, such as the Dropdown Menu, who has a selected value, and a selected text. Which one to display ?

The Advanced String Variables exist for these situations.

Classic Use

An Advanced String Variable can be used by setting a canvas' field to a string that contains the token $myVariable$. Unlike normal text variables, this variable can be set anywhere in the string :

"text": "My Name is $name$"

You can even have multiple variables in the same string :

"text" : "My Name is $name$ and I'm $age$ years old"

And that's it !

The following editable fields generate an advanced string variable :

Special values

Some fields have special values accessible from the advanced string variables. If nothing is specified, then only the classic use will work.

A special value is used in the same way as a normal advanced string variable, but requires the use of an attribute :

"text" : "My Name is $name$ and I'm $age.value$ years old"

As you can see, we have added the value attribute to the age variable by using a dot between the variable & the attribute. The existing attributes are listed below.

Dropdown Menu

Dropdown Menus have two special values :

  • text is the text displayed in the field, that the user selected
  • value is the value of the selected option, that can be more of a constant, with less information.

Rich Text Field

Rich Text Fields have two special values :

  • text is the text entered in the field, without the formatting (bold, italic).
  • html is the html version of the text (with attribute <b> for bold, <i> for italic, <br> for linebreaks, ...