Variables
Variables allow you to write content once, and manage it in one place for reuse across your project because variable hotspots are replaced with variable text in the final output. There are two basic kinds of variables: text and rich content. Both are created in the Variables window in Doc-To-Help—and you can create rich text variables from the Doc-To-Help Project panel in Word
Text variables may be used for any amount of non-formatted text. They will use the formatting that is used at their insertion point in the document.
When adding a new text variable, you can select one of three types: Text, Version, or Date/Time.
- Text A text variable is the type that has been used in previous versions of Doc-To-Help. This lets you enter simple text.
-
Version This lets you enter a version in one of four available formats:
- 1
- 1.0
- 1.0.0
- 1.0.0.0
If you click the Build button, unchanged documents won't be processed, so variables won't be updated in those unchanged documents when you view the output, although they will be incremented in the Variables window where you created them.
If you want to force variables to update in all documents, you need to click Rebuild instead. Each time you click the Rebuild button for a target that has the variable, the version values are incremented automatically—whether the documents have changed or not—in both the output and the Variables window.
When version variables are updated, only the last part of the number is incremented automatically.
ExampleExample
Let's say you create a version variable with the 1.0.0 format, insert it into a document, and build a target.
If you rebuild the target, the variable changes in the output to 1.0.1.
If you rebuild again, it changes to 1.0.2.
If the variable value reaches 1.0.9 and you rebuild, it changes to 1.0.10, then 1.0.11, then 1.0.12, and so on.
NotesNote You can open the Variables window and change the variable value manually at any time.
Note The variable value is incremented only if this variable was used in building the current target, so all variables that were excluded from the build process due to their condition won't be changed.
-
Date/Time These variables get their values either from current system date/time, or from file date/time attributes. This means that you cannot set its value manually (for this purpose, you can use simple "text" type variables).
Example
- Product or company name
- Frequently used descriptions
- Addresses
- Copyright notices
- Document version
- Date of publication
Note If you are working in Word, you can hover over any text variable in the Variables window pane (Doc-To-Help > Project Panel) to view its definition.
Rich content variables may be used for blocks of formatted content. They are stored in source documents and will use the formatting applied to the variable itself.
Example
- Tables
- Images or other media
- Formatted company names
- Entire topics
You can assign conditions to text variables, providing even more flexibility for their use. If you’d like, you can create a single variable, and assign multiple text values and conditions for it. This lets you insert a variable once, and have different text be used in each of your conditions.
Conditions can be especially useful if you have multiple targets and want version numbering to be incremented separately for each target. After creating multiple version variables, you can associate target conditions with each one. On the other hand, if you create only one version variable and use it in several targets, the version number will increment after each rebuild of any of those targets.
Rich content variables can include text that has been conditioned.
Following are the main tasks involved with using variables.
- Create Rich Content Variables If you want to use formatted variables, you need to create them first. See Creating Rich Content Variables.
- Create Text Variables If you want to use text, version, or date/time variables that are not formatted, you need to create them first. See Creating Text Variables.
- Insert After creating variables, you can insert them into source documents. See Inserting a Variable.