8.18/6/2018

Use Variables in a Text Object

You can reference both system and global variables from a text object. The global variables you reference within a text object can be of type string, measure, integer, and currency.

If you reference a global variable in a text object and subsequently change the type of the global variable to one not supported by the text object, PlanetPress Design replaces the global variable in the text object with a blank space. The next time you open the text object, an error message appears in the Messages area of the Object Preview and in the status bar of the text object. You cannot exit the text object until you remove all references to the global variable.

You can also create local variables that are internal to the text object. The value of a local variable can be a data selection, a constant, or a PlanetPress Talk expression.

You insert a data selection in a text object by creating a local variable that contains the data selection. Note that you cannot modify the value of those variables through the PlanetPress Talk before paragraph and PlanetPress Talk after paragraph properties.

Also note that if you use a global variable to display Arabic text in a Text object, the data will not be displayed correctly in the application. To fix this, you need to initialize the variable content using the MapUTF8 PlanetPress Talk command.

To determine the variables currently available in the text object, do any of the following:

To insert an existing variable, do one of the following:

To quickly insert a data selection as a local variable:

  1. Choose Variables | SelectData.

  2. Use the Data Selector to select the data for the variable.

  3. Close the Data Selector.

    PlanetPress Design inserts the variable, highlights it in blue, and displays its value on the current data page. PlanetPress Design also adds the variable name to the menu that appears when you right-click and choose Data Selections Available.

    You can use the Data page box in the toolbars to navigate through the data pages and view the value of the variable on other data pages.

To create a new local variable using the Variables dialog box:

  1. Choose Variables | EditDataSelection.

  2. Click Add Variable.

  3. Click the variable name to select the variable. Then click the variable name a second time to select the name. Edit the name, then click outside the variable name.

  4. Click the variable in the Variables list to select it.

  5. Use either of the following to define the value of the local variable. The value of the variable on the current data page appears in the Variables list, beside its name and type.

    Define a Data Selection value

    Clear Custom data selection and define the new value by creating a data selection using either the line and column boxes or the Data Selector.

    If you use the Data Selector to select the data for the variable, and you select data that extends over more than a single line, PlanetPress Design uses only the data on the first line (or record) as the data selection for the variable. Note that in a database emulation, the Data Selector does not permit selections that extend over more than a single field.

    Trim leading spaces: Select to remove any ASCII space characters that appear before the data in the data selection for the variable.

    Trim trailing spaces: Select to remove any ASCII space characters that appear after the data in the data selection for the variable.

    Define a Constant value OR a PlanetPress Talk Expression

    Select Custom data selection and enter a constant value or a PlanetPress Talk expression in the String to display box.

  6. Click OK.

To display the name of a variable in the Text area:

To edit the definition of a local variable:

  1. Choose Variables | EditDataSelection.
  2. In the Variables list, select the variable you want to edit.
  3. Right-click the variable name and choose Rename. Edit the name, then click outside the variable name.
  4. In the Variable value area, edit the value of the local variable.
  5. Click OK.

To delete a reference to a variable:

To delete a local variable in the Text area:

  1. In the Text area, select any reference to the variable you want to delete.
  2. Right-click and choose Delete data selection.

To delete a local variable using the Variables dialog box:

  1. Choose Variables | EditDataSelection.
  2. In the Variableslist, select the local variable you want to delete.
  3. Press DELETE.
  4. Click OK.

To avoid an empty line in output when a line contains only variables, none of which contain data:

  1. In the Format toolbar, locate the Skip Empty Paragraphs icon. If this toolbar is not visible, right-click in the toolbar area of the Text area and choose Format.
  2. Set the Skip empty paragraphs option. Click to turn this option on or off. When the option is on, if a line in the Text area contains only variables, and none of those variables contain data, the line does not appear in the output. When this option is off, an empty line appears in the output.