Working with variables

Variables pod

You can use the Variables pod to insert, edit, or delete system and user variables.

View full size graphic
Variables pod
A.
Select the file

B.
Insert a variable in your document

C.
Create a new user variable

D.
Edit a variable definition

E.
Delete a user variable

F.
Convert a variable to text

G.
Update all system variables

H.
Refresh the pod data

I.
Search for a variable

J.
System variables

K.
User variables

L.
Variable format

M.
Document in which the variable exists

Insert a variable

You can insert most system variables on a body, reference, or master page.

  1. Access the Variables pod from View > Pods > Variables.

  2. Click to place the insertion point where you want the variable to appear in the document. If you’re inserting the Current Page # variable or a running header/footer variable, click in a background text frame on a master page.

  3. Double-click a variable from the Variables pod to insert it in your document. Alternatively, click the Insert icon on the pod toolbar.

    The Variables pod contains the variables allowed at the insertion point in the document. For example, if the insertion point is in a text frame on a body page, the scroll list doesn’t contain the Current Page # variable. If the insertion point is in a text frame on a master page, then more variables are displayed in the Variables pod.

In most cases, the value of a variable inserted on a master page appears on both the master and the corresponding body pages. However, if you insert the Current Page # variable, a number sign (#) appears on the master page, and the actual page number appears on the body page. If you insert a running header/footer variable, the variable name appears on the master page, and the value appears on the body page.

Insert variable elements in structured documents

You can use an element to insert a variable in a structured flow. You can also insert a variable directly in text, without using a special variable element. For example, you can include the Chapter Title Name as part of a body element.

FrameMaker comes with a set of system variables. The format rules of a variable element determine which variable to use with it. You cannot change a system variable element to use a different variable.

The values of system variables you insert are updated when you open or print the document. You can also update system variables manually. (System variables in headers or footers are updated when the page is redisplayed.)

  1. Click where you want to insert the variable.

  2. Select a system variable element in the Element Catalog and click Insert.

  3. If the Attributes for the New Element dialog box appears, enter attribute values for the element and click Insert Element.

    The current value of the variable appears at the insertion point. A bubble for the variable appears in the Structure View, with a text snippet that shows the beginning of the variable text.

  4. To update all variables in the current document, click Update on the pod toolbar. To update variables in all open documents, first select All Open Docs and then click Update on the pod toolbar.

If your application has user variables already defined, you can insert variable elements in your document. You can insert a user variable directly in text, without using a variable element. Perhaps your application has user variables already defined. You can define and maintain other user variables as needed. If the value of a user variable changes, it is updated automatically wherever it occurs.

Edit or delete a variable occurrence

If a variable is added to a master or reference page, you cannot edit its occurrence in the body pages. In the master or reference page, you can swap the variable with another variable or edit the variable definition. If you edit a variable definition, then all occurrences of the variable in the document are updated.

Alternatively, you can convert a variable to editable text and then edit the text in the document. If you convert the variable to text, however, the text is no longer updated when the variable definition changes.

You can delete variable occurrences from a body page but you cannot delete a variable included in the header or footer of a master page from the body page. Also, backspacing the insertion point over a variable in the document doesn’t delete the variable. You can remove or edit a variable in the following ways:

  • To delete one occurrence of a variable:

    1. Select the variable name from the Variables pod and click Edit.

    2. From the Add/Edit Variables panel or the Edit System Variables panel, select the instance from the Location list and click Delete.

  • To copy or move a variable, select it and choose Edit > Copy, Edit > Cut, or Edit > Paste.

  • To replace a variable, select the variable in the Document view, and then double-click a different variable in the Variables pod.

  • To delete a variable in a text inset, delete the variable in the source document.

Note: Deleting a variable definition converts all occurrences of the variable in your document to editable text.

Convert a variable to text

  1. Select the variable, click Convert To Text from the Variables pod.

  2. Do one of the following:

    • To convert a single occurrence of a variable, click Selected Variable.

    • To convert all occurrences of a particular variable, select the variable in the Variables Named scroll list. For structured documents, you can also choose the variable element tag from the Variables With Element Tag pop-up menu.

    • To convert all variables in the document, click All Variables.

  3. Click Convert.

Import variable definitions

 To import variable definitions from another document, choose File > Import > Formats.

Update variables across all files in a book

  1. Update the variables in one document from the book.

  2. Select all the remaining files in the book and choose File > Import > Formats.

Create a user variable

A user variable is useful for a product name that can change or for a long manual name that is difficult to type each time. You can add a new variable and edit its definition from the Add/Edit Variable panel.

View full size graphic
Add or edit existing user variable definitions from the Add/Edit Variable panel
A.
Name of the new variable or variable selected in the Variables pod

B.
Specify or edit the format definition for the variable

C.
Select from the list of building blocks to define the variable format

D.
Name of the file that contains the selected variable instance in the Variables pod

E.
Location list displays the location of the selected variable in the document. It displays the page number and the headings under which it appears

F.
Add a new user variable

G.
Edit the definition of a variable

H.
Highlights the selected variable in the Document view. Select an instance from the Location list and click this button.

I.
Refreshes the data in the Location list

J.
Deletes the selected variable instance selected in the Location list from the document.

If you don’t specify a character format in the variable definition, the variable uses the format at the insertion point. If you change the character format for the variable, the change applies only to the variable, not to the text that follows.

  1. Click Create New User Variable from the Variables pod.

  2. Enter the name and definition of the variable. Use these guidelines:

    • Variable names are case-sensitive.

    • The complete definition, including typed text and character formats, can be up to 255 characters long.

    • You cannot use system variable building blocks for user variables.

    • To include an angle bracket in a variable definition as text, precede it with a backslash (\).

    • Enter a sequence of characters beginning with a backslash (\).

    • To create a multiline variable such as multiline address, append \r for each line. Do not press Enter to insert a line break.

  3. To change the character format within the variable definition, do the following:

    • To use a character format stored in the Character Catalog, place the insertion point in the Definition box where you want to change the character format. Then click the character format in the Character Formats scroll list. The scroll list includes all the formats in the Character Catalog of the current document.

      Important: Don’t use a character format whose tag includes angle brackets.
    • To return the character format to the paragraph default font at the end of the variable, place the insertion point in the Definition box where you want to change the character format. Then click <Default Font> in the Character Formats scroll list.

  4. Click Add.

  5. To add more user variables, repeat steps 3 through 5.

Edit a variable definition

You can edit both system variables and user variables. For a system variable, you can edit its format by changing its building blocks in the Edit System Variable panel. To do so, select the system variable in the pod and click the Edit button.

View full size graphic
Edit system variable definitions from the Edit System Variable panel
A.
Name of the variable selected in the Variables pod

B.
Displays the format definition for the variable

C.
Select from the list of building blocks to define the variable format

D.
Displays the name of the file that contains the selected variable instance in the Variables pod

E.
Location list displays the location of the selected variable in the document. It displays the page number and the headings under which it appears

F.
Edits the definition of the selected variable

G.
Highlights the selected variable in the document. Select an instance from the Location list and click this button.

H.
Refreshes the data in the Location list

I.
Deletes the selected variable instance selected in the Location list from the document.

If the variable is in a header or footer on a master page, redisplay a body page to see the updated definition.

For user variables, you can change the variable name and the variable format from the Add/Edit Variable panel.

View full size graphic
Add or edit existing user variable definitions from the Add/Edit Variable panel
A.
Name of the new variable or variable selected in the Variables pod

B.
Specify or edit the format definition for the variable

C.
Select from the list of building blocks to define the variable format

D.
Name of the file that contains the selected variable instance in the Variables pod

E.
Location list displays the location of the selected variable in the document. It displays the page number and the headings under which it appears

F.
Add a new user variable

G.
Edit the definition of a variable

H.
Highlights the selected variable in the Document view. Select an instance from the Location list and click this button.

I.
Refreshes the data in the Location list

J.
Deletes the selected variable instance selected in the Location list from the document.

Note: If a variable is in a text inset that uses the source document formats, change the variable definition in the source document.
  1. Select the variable from the Variables pod and click Edit .

  2. Do one of the following:

    • For user variables, edit the variable name or change its definition in the Add/Edit Variable panel and click Edit.

    • For system variables, edit the definition and click Edit.

      Insert a building block for system-supplied information or for a character format at the insertion point. Click the building block in the Building Blocks scroll list. Only the building blocks appropriate for the variable appear in the scroll list. For example, <$fullfilename> and <$filename> appear for the filename variables. All the character formats in the Character Catalog appear at the bottom of the scroll list.

    All instances of the variable in the document are updated with the new format.

Changing definitions of date and time variables

FrameMaker includes both long and short versions of variables for the current date, the date the document was last modified, and the document creation date. FrameMaker provides the following building blocks for date and time variables.

Building block

What it displays

Example

<$second>

<$second00>

Seconds

8 or 32

08 or 32

<$minute>

<$minute00>

Minutes

8 or 32

08 or 32

<$hour>

<$hour01>

<$hour24>

Hours

8 or 12

08 or 12

08 or 22

<$ampm>

<$AMPM>

Morning or evening designation

am or pm

A.M. or P.M.

<$daynum>

<$daynum01>

Number of the day

8 or 28

08 or 28

<$dayname>

<$shortdayname>

Name of the day

Monday

Mon

<$monthnum>

<$monthnum01>

Number of the month

8 or 12

08 or 12

<$monthname>

<$shortmonthname>

Name of the month

August

Aug

<$year>

<$shortyear>

Year

1997

97

FrameMaker uses the language of the current paragraph to determine the language used in date and time variables. For example, the current day name variable sometimes appears as Wednesday in an English paragraph but as Miercoles in a Spanish paragraph. If you change the language of a paragraph, the system variables in the paragraph are updated to use the new language.

If your system supports the typing of Japanese text in documents and dialog boxes, the following additional building blocks are available for Japanese dates.

Building block

Example

<$daynumkanjikazu>

or

<$daynumkanjinumeric>

or

<$monthnumkanjikazu>

or

<$monthnumkanjinumeric>

or

<$imperialyear>

1 or 10

<$imperialyear01>

01 or 10

<$imperialyearspecialkanjikazu>

or

<$imperialyearspecialkanjinumeric>

or

<$imperialyearkanjikazu>

or

<$imperialyearkanjinumeric>

or

<$imperialera>

Japanese dates appear in a variable when the variable uses a Japanese font family and the Language property is set to Nihongo.