Variables Part 2: Where and How?

October 4, 2019 Josiah Feuerbacher

Last week, we looked at how to set a variable on a content player, and how to reference it in a Text content item. There are probably hundreds of other places and ways to use variables inside Content Manager, and in this week’s edition of #DoYouFWI, we’re going to look at a few more.

In each example, I will use a variable called “MyVariable”.

So, you want to use a variable…

…in a URL.

Using a variable in a URL allows you to point your content items at different content dynamically. To use a variable in a URL, wrap it in percentage signs: %MyVariable%.

Other Uses for this syntax:
C:\MyFolder\%MyVariable%
http://myserver.com/%MyVariable%


…in a URL Query String


Say you have the following webpage:
http://myserver.com/variables?page=1


And you need to change the “page” field based on a user’s selection. You would first create the variable, then use it in the Live Data Dynamic URL window as follows:

As seen above, select “Machine Variable” from the dropdown, and enter your variable name in the right text field.

…in a Markup Text Field


In the Layout Editor for Live Data, Control Pad, Date/Time, and Weather content items, variables can be added to a Markup Text Field by wrapping the variable in curly braces and using the prefix “&var:”

Other Uses for this syntax:
Floor Number {&var:MyVariable}
{&var:MyVariable} days to


…in a script


Variables can be used inside scripts, too. In the example below, the variable “MyVariable” is first given a value of “Background_Image”, then it is used in a script to play the “Background_Image” content item in a region called “Background_Region”:


Plain Text:
Player.SetVariable(MyVariable, Background_Image);
Template.PlayContent({&var:MyVariable}, Background_Region);


Other Uses for this Syntax:
Template.PlayContent(MyContent, {&var:MyVariable});
Content.SetVolume({&var:MyVariable});
More Useful Information on Scripting


…as a Content Item Duration


In the Properties window of any content item is a field for “Duration variable name”. If you place a variable in this field, the content will get it’s duration from that variable, as seen below:

In the case of durations, the variable would contain a value in the format:
hh:mm:ss


Depending on the content item, the Properties window contains many other variable options, such as “Zip code variable” (Weather content item) or “You Are Here location variable” (Big Maps & Wayfinding content items). In all cases, simply fill the field with the variable name as shown above.

…in an expression


Expressions, which we’ll cover in more detail later, allow you to perform logic and calculations on variables. For instance, the following expression adds 1 to the value of “MyVariable”:
{&exp:[&var:MyVariable] + 1}


Variables in expressions are wrapped in square braces and prefixed with “&var:”.


Recap


We’ve looked at a number of places where variables can be used inside Content Manager, and I’m sure there are even more. We’ll come back to the concepts of variables pretty regularly.

#DoYouFWI?

Previous
Do More With Less. Done Right.
Do More With Less. Done Right.

Read about how operations executives can benefit from one of FWI's Visual Communications solutions and get ...

Next Up
Big Ideas at NRF's Big Show 2016
Big Ideas at NRF's Big Show 2016

Four Winds Interactive was at NRF's Big Show 2016 showing off some of the best and biggest ideas in the vis...