Skip to content

Canvas Advanced String Variables

Nicolas Ronvel edited this page Jul 28, 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 4 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.
  • image is the url / data-url of the image property of the selected option, or of the miniature property if there is no image, or an empty string if there is no image and no miniature.
  • miniature is the url / data-url of the miniature property of the selected option, or of the image property if there is no miniature, or an empty string if there is no miniature and no image.

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, ...

Color Picker Field

Color Picker Fields have several special values. See the main page of this type of field.