About variables

You can include text that frequently changes and appears often in your document as variables. Variables are also useful for providing information that is updated automatically, such as the current date. In FrameMaker, you have system variables and user variables. System variables are maintained by FrameMaker, such as current date or filename. User variables are variables that you define in FrameMaker, such as company name or product name.

System variables

Each system variable has a name and a definition. Although you cannot rename system variables, you can edit their definitions. A system variable definition can contain the following items:

  • Building blocks for system information, such as the month, day, year, and filename

  • Text characters, such as the comma and the spaces that appear in the date May 1, 2012

  • Building blocks for character format changes

For example, the Table Sheet variable that appears in a table title as (Sheet 3 of 5) has the following definition.

A.
Text you type

B.
Building blocks

You can change the definition—the way the information is displayed—by adding, removing, or rearranging building blocks and by editing the text in the definition. For example, you can change the format used to display the current date.

The most common way to use system variables is in document templates as part of background text frames, such as headers and footers. A background text frame is on a master page and doesn’t have a flow tag. For example, the Current Page # and Running H/F variables can reside only in a background text frame on a master page. The values of these variables appear on the corresponding body pages. You can use system variables to create running headers and footers that contain chapter titles, section headings, or information that changes from page to page.

System variable names appear on master pages.
FrameMaker provides values on body pages.

The values of system variables inserted on master pages are updated automatically. However, if you place a system variable on a body or reference page, the value is updated only when you open or print the file.

You can also manually update the value of the variable when the file is open. Access the Variables pod and click Update.

Note: Variables and variable names support the Unicode text encoding standard.

Default values for system variables

System variable

Default definition (US English version)

Example of display

Current Page #

<$curpagenum>

3

Page Count

<$lastpagenum>

18

Current Date (Long)

<$monthname> <$daynum>, <$year>

October 11, 2012

Current Date (Short)

<$monthnum>/<$daynum>/<$shortyear>

10/11/12

Modification Date (Long)

<$monthname> <$daynum>, <$year>, <$hour>:<$minute00> <$ampm>

September 24, 2011, 10:48 am

Modification Date (Short)

<$monthnum>/<$daynum>/<$shortyear>

9/24/11

Creation Date (Long)

<$monthname> <$daynum>, <$year>

July 1, 2012

Creation Date (Short)

<$monthnum>/<$daynum>/<$shortyear>

7/1/12

Filename (Long)

<$fullfilename>

c:\Memos\Staffing.fm

Filename (Short)

<$filename>

Staffing.fm

Table Continuation

(Continued)

(Continued)

Table Sheet

(Sheet <$tblsheetnum> of <$tblsheetcount>)

(Sheet 1 of 2)

Volume Number

<$volnum>

3

Chapter Number

<$chapnum>

3

Section Number

<$sectionnum>

3

Sub Section Number

<$subsectionnum>

3

Chapter Title Name

<$chaptertitlename>

Cyclonic storms

Running H/F 1

<$paratext[Title]>

The Turbulent Oceans

Running H/F 2

<$paratext[Heading1]>

Threat of Extinction

Running H/F 3

<$marker1>

Plate tectonics

Running H/F 4

<$marker2>

Volcanoes

Running H/F 5–12

<$paratext[paratag]>

Lava

Running H/F 13

<$marker3>

Lava

Running H/F 14

<$marker4>

Lava

Running H/F 15

<$marker5>

Lava

Running H/F 16

<$marker6>

Lava

Running H/F 17

<$marker7>

Lava

Running H/F 18

<$marker8>

Lava

You can use the <$chaptertitlename> variable to propagate the folder name in the template associated with the folder.

User variables

Each user variable has a name and a definition. A definition includes text and optional building blocks for the character format of the text. For example, suppose you define a variable as follows:

<BookTitleFormat>The Earth Sciences

If the BookTitleFormat character format is defined as italics, this variable appears on the page as The Earth Sciences.

You can change the definition of any user variable, for example, when the book title changes. When you change the definition, all occurrences of the variable in your document are updated to use the new definition.

The standard templates don’t provide any user variables. If you’re using one of these templates, create your own user variables. If you’re using a template created at your site, perhaps it already includes some user variables.

Valid variables in structured documents

You can add a system variable to a structured flow, with or without a special variable element. You do not use special variable elements for user variables but insert them directly in elements defined for text.

The following building blocks in running header/footer variables are used in elements:

Building block

Meaning

<$elemtext[tag]>

The text (up to the first paragraph break), excluding its autonumber, but including any prefix and suffix specified in the element definition.

<$elemtextonly[tag]>

The text (up to the first paragraph break), excluding its autonumber and any prefix and suffix specified in the element definition.

<$elemtag[tag]>

The tag of the source element

<$elemparanum[tag]>

The entire autonumber of the first paragraph of the element.

<$elemparanumonly[tag]>

The autonumber counters of the first paragraph, including any characters between them.

<$attribute[AttributeName]>

The value of the attribute with the specified name (or, if no value is specified, the default value)

<$attribute[AttributeName:ElementName]>

The value of the attribute of the specified element (example, structured book element)

Variables in FrameMaker are exported as entities, and usually the entity name is the same as the variable name. However, if you create a variable whose name is not a valid XML or SGML name, the entity name is not the same as the variable name.

Here are some examples of invalid names:

  • A name with multibyte (Asian-language) characters.

  • A name that includes anything other than alphanumeric characters, hyphens, or periods.

  • A name containing more characters than the number specified by the value of NAMELEN in the XML or SGML declarations for the particular application.