Editing Variables

After you create a variable, you can edit it in the Variable Set Editor, changing the name, definition, or comment. If you change the definition for a variable that has been inserted into topics, the changes will automatically be reflected in all those topics. You can also add multiple definitions to a variable, using them as a way to override variables on a target. For example, your company might have multiple phone numbers. You can associate them all with the same variable and use the appropriate one wherever necessary.

How to Edit a Variable

  1. Open the Project Organizer.
  2. Double-click the Variables folder. Your variable sets are displayed.
  3. Double-click the custom variable set (such as MyVariables) that contains the variable you want to modify. The Variable Set Editor opens to the right, with the variables page shown.
  4. Double-click in a field and type the name, definition, or comment. (You can also click once in a field, press F2 on your keyboard. Then type the name, definition, or comment.) If you want to insert a variable in a field, you can click Add a variable definition.. The variable will appear as syntax in the field, but in the output the variable definition will be shown.

    Warning If you rename a variable (e.g., PhoneNumber), giving it the same name as an existing variable (e.g., CompanyName), you will see a warning message. If you click OK to accept the new name, this will result in multiple definitions for the variable (e.g., CompanyName will contain both its original definition and the one that had been associated with PhoneNumber). Do not click OK, then undo after saving. This changes all instances of the unchanged variable (e.g., CompanyName) to the one you first started to change (e.g., PhoneNumber) throughout the project. This undesired action cannot be undone.

    Note If you want to see the variable syntax replaced by the variable definition, click Toggles between showing variable definition and syntax in the local toolbar of the editor. This shows you the "Evaluated Definition," which determines the actual text of the variable.

    Note You cannot change system or Heading variables. If you are working with Running Head variables, you should not change the first part of the definition, but you can change the style within the definition. See Running Head Variables.

  5. Click Save the active file. to save your work.

How to Add Variable Definitions

  1. In the Project Organizer, double-click the Variables folder.
  2. Double-click a variable set. The Variable Set Editor opens.
  3. Click on a row where you want to provide an additional definition.
  4. In the local toolbar click . A new row is added for the new definition.
  5. In the empty cell that is added, type the definition and press ENTER. If you want to insert a variable in a field, you can click Add a variable definition.. The variable will appear as syntax in the field, but in the output the variable definition will be shown.

    When a variable has multiple definitions, cells of the non-default definitions are grayed out (except for the definition cell).

    The default definition is determined by the order of creation. The first definition created is the default.

    The Variable Set Editor showing multiple definitions for a variable.

    Note If you want to see the variable syntax replaced by the variable definition, click Toggles between showing variable definition and syntax in the local toolbar of the editor. This shows you the "Evaluated Definition," which determines the actual text of the variable.

  6. Click Save the active file. to save your work.

What’s Noteworthy?

Note If you want to change how variables look when they display in the XML Editor and in generated output files, you can edit the MadCap|variable style in the Stylesheet Editor. See Styled Variables.

Note If there is a variable inserted within another variable in the Variable Set Editor, a warning will show if it is invalid. Also, the cell containing the invalid syntax is shown in pink.