Variables Part 1: What's in a Variable?

October 4, 2019 Josiah Feuerbacher

This week, we’re going to take a step beyond the basics and look at variables. Variables are really, really important. You can use variables every day to help determine where content should be displayed, or to store important information which you’ll use later in your application.

A variable is simply a little box that we place information into. The box has a name, and we can grab the information later by using that name. In this post, we’ll use variables to display dynamic text on screen.

Let’s start with a simple variable called “FloorNumber”. FloorNumber is going to hold (surprise surprise) on what floor of a building each sign is located. We’ll assume that we’re all working in a three floor building, and we have one sign on each floor. Really quickly, you can setup an example like this in Content Manager:

In the image above, we have added three players and a playlist to a location. We’ve also added a full screen template to the playlist, so that it will appear on every player.

Right click on the first player, and choose “Variables” from the list. This will open the Variables window. This is one of the many ways we can set a variable in Content Manager. In the name field, add a variable called “FloorNumber”, and in the value field, add the number “1” (for the first floor):

By doing this, you have assigned this variable to this player. And now any time you reference the variable called “FloorNumber” in a sign, it will be equal to the number 1.

Go ahead and follow these same steps on the other two floors, but give them values of 2 and 3, for second and third floors.

Next, we want to add a Text content item to Background region. I named my item “Floor Indicator”, and gave it the text “You are on Floor 1”, like so:

If you any of your screens now, you will see “You are on Floor 1” displayed in the middle of the screen. But on Floor 2, we want it to display “You are on Floor 2”. And likewise for Floor 3. So what gives?!

This is where the variable comes into play. Since you’ve assigned a variable called “FloorNumber” to each player, you can use that variable inside your text item. To do this, use the following text:

{&var:FloorNumber}

Let’s take a closer look at that. First, we start with curly braces { } . The curly braces just tell Content Manager and Content Player that something special is inside. We have a name for this special something, and that is Markup text.

Next, we see that we have &var:. That is short for VARIABLE. We’re telling Content Manager that we are going to be giving the name of a variable.

Finally, we finish with the name of the variable that we want to reference. In this case, that is “FloorNumber”.

Lastly, in order for the Text content item to treat this as a variable, we much check the “Has markup fields” checkbox, highlighted below:

Also notice that I’ve added the {&var:FloorNumber} in place of the “1”. I want to substitute my variable in that place.

Shew! With all that work done, now go back and preview your signs again. On the first floor, you won’t see any difference. But when you preview the second floor, you will see that it says “You are on Floor 2”. You’ve added dynamic text which you can change on the fly, without needing to duplicate multiple text items, or assign a unique template to each screen. Pretty cool, huh?

Variables can be used all over Content Manager. You can use them to replace zip codes in a Weather content item. You can use them inside of a URL to automatically point to different files. The possibilities are pretty endless. Can something be “pretty endless”? I guess it’s just “endless”.

So next week we’ll look at some other places and ways to use variables inside Content Manager.

Oh yeah, I almost forgot. #DoYouFWI?

Previous
We're Different
We're Different

Find out what sets Four Winds Interactive apart from the competition. From our superior platform to our app...

Next Up
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 ...