7.5

Table Of Contents
Common Uses of Variables
The following are several common uses for variables:
l Store values that you want to reference at various places in the document.
l Concatenate strings For example, you want to create a footer for each page of a patient record document that con-
tains the patient’s name, physician’s name, file number, and date the record was last updated. All the pieces of infor-
mation are available in the input data.
l Perform calculations For example, the input data for your financial statement document does not include a figure
for year-to-date earnings, but does include earnings per month.
l Create counters For example, the input data for your invoice document contains a variable number of line items for
each invoice.
Create a Global Variable
To create a global variable:
1. Choose Home | Document | Global Variable.
2. Enter the name and type of the global variable you want to create.
Name: Enter a name for the global variable.
Variable type: Select the type of the global variable (string, integer, measure, currency, Boolean, integer array,
measure array, string array, Boolean array, or directory array).
String Variables are limited to 65534 characters.
3. Define the properties specific to the type of variable you selected. Consult the PlanetPress Talk Language Reference
for help understanding the various types.
l If you selected a variable type of string, integer, measure, currency or Boolean, enter an initial value for the var-
iable in the Default value box. Note that you cannot use PlanetPress Talk code to define an initial value.
l If you selected a variable type of color array, click the Color button to use the Color Picker to select an initial
color for the color array. The Color box updates to reflect the selected color.
l If you selected a variable type of integer array, measure array, string array, or Boolean array, enter the
number of elements you want the array to contain in the Array size box, or use the spin buttons to adjust the
value.
l If you selected a variable type of directory array, enter the path to the folder containing the files you want to ref-
erence, and any filter you want to apply to names of the files in that folder, in the Path and filter box.
4. Click OK.
The new global variable appears in the Global variables folder in the Structure area.
It also appears on the Global variables submenu available from the Code area of the PlanetPress Talk Editor, from the
PlanetPress Talk properties of an object, and from any text box that accepts PlanetPress Talk expressions
To reference a global variable:
l Enter the name of the global variable by hand, preceding it by an ampersand. For example, to reference the global var-
iable subtotal, enter &subtotal. In the case of an array element, you must include the position of the element in the
array.
To set a global variable:
l Use either the PlanetPress Talk assignment operator (:=) or set() command. For example:
&code := &code + 1
©2010 Objectif Lune Inc - 225 -