Using Variables

EachScape app can store and retrieve data from variables.
For example, review the VARIABLE Tutorial App

Variable are accessible through the Action Editor.
Their full list is shown along with system values, Formatters & Functions:

For example, if you want to save the color choice made by the user, or a default value to search for, or whatever, you can set the variable “color” to “green” by using the Set a Variable action. Once you've done that, you might want to retrieve the color. To use a variable (and more generally expand an expression) we use double bracket: [[ expression ]]

	The color you picked is [[var:color]]. Nice choice!

When the system encounters this, it will know to look for the  “color” variable. If “color” isn't defined as a variable, you'll get a blank value substituted for that part of the result.

You can utilize variables throughout the platform. One very common usage is in a text or html block. 

Math Operations

The mathematical operators can accept either a number or the name of a variable as a parameter, as mentioned in the formatter tutorial. So, let's say you had a variables w, x, y, and z, and you wanted to do something like (w + x) / y * z to calculat that expression you would use:

You would use [[var:w:add x|div y|mul z]]

 If you set a variable called "joe" to have a value of "hello world"  and the
[[var:joe]] is used in an html or text block text it will just display the text, "hello world" in that block.

If the joe variable has a value of an image path and it’s used in an image tag inside an HTML block <img src=“[[var:joe]]”> it will display the image in the HTML block.

 If the joe variable has a value of a URL and it’s used in an <a href=“[[var:joe]]”> the HTML block will link to the url.


Variable in HTML Block

You can use a variable in an HTML Block, for example:

if your variable contains a text: <h1>[[var:myArticleTitle]]</h1>

if your variable contains a URL: <a href="[[var:myLink]]">Text</a>

If your variable contains an image link:    <img src="[[var:myImagePath]]">

See also: