Series 5 Basic Class - Self-Paced Modules
Variables
What is a variable?
Variables are containers that hold values for later use. (See video sidebar below.) Let's see how they are created and used in Series 5.
Creating a variable
- Create a new, blank publication.
- In the logic area, click on Section / Insert Object Here.
- From the main menu, select Insert / Set Variable.
Two windows appear - Variable and Set Variable.
You will create the variable object in the "Variable" screen and put a value in the variable in the "Set Variable" screen. Let's create the variable first.
- In the Variable window, click New.
- In the Name box, type MyVar.
- Click in the Type box. Notice you can choose from a list to set the type of value you can place in this variable. Also note that once you have chosen a type, you can't go back and change it.
- In the Type box, select String.
- Click Create. Note the Variable box goes away.
- In the Label box, type Customer Name.
- In the Value box, we will place the value we wish to save in the variable. In the Value box, type John Smith.
- Click Create.
Now that we've saved the value, we'll use it on the page.
- In the document view, click on the document. You will see the blinking cursor at the top left of the page.
- Type Dear.
- Hit the space key once.
- From the main menu, select Insert / Field / Variable.
- Ensure the varialbe MyVar is selected. You select a variable in this screen by clicking on the square boxes to the left of the variable.
- Click Create.
- Note the contents of your variable have now been placed on the page.
Note the contents of the variable are pink with grey background. This is just to give you a visual cue of the varibles on the page. It will actually print in the colors you select.