Variables

Variables allow you to enter a string that can be inserted in topics, topic titles, master pages, snippets, index entries and a table of contents. They are used where the string could change in the future.

Company and product names are good examples. Instead of having to edit every place the company or product name is used, you insert a variable. When the value of that variable changes, you change it once and it cascades to wherever you have used it.

Another scenario is where you need to change the string in different outputs. For example, you might sell the same product to different countries using a different name in some countries. The first step would be to create a variable called Product Name in which you set a default value being the name used in most countries. Then you could create sets for say Market 1 and Market 2. The Product Name would be duplicated in those two sets. In the Default Set you would enter the regular name and that would be copied to the Market 1 and Market 2 sets where you would change that to whatever is required.

 Prior to Update 4, variables were created in the Authoring panel and sets were create in the Output panel. In Update 4, they have been brought together in the Authoring panel.

Upgrading

If your project is from any new UI version before Adobe RoboHelp 2022 Update 4, any existing variables will show along with any sets you have created. There is no change in how the feature works, it is simply a change to make set up and editing easier.

Adding a Variable

Select Variables in the left panel. You will see a blank screen if you have not previously created any variables, otherwise you will see them listed in alphabetical order.

To add a variable, click the pencil edit icon to open the Variables editing panel

Enter the name of the new variable and its default value, then click the + icon. Ignore the dropdown and Settings for now. They will be covered in Variable Sets.

If you will need lots of variables, consider adding a prefix to them so that they are grouped. For example, prefix any variable relating to the markets you operate in with MKT, any variables relating to the organisation you work for with ORG and so on.
As the list of variables is alphabetical, this will keep them together.

Editing a Variable

  • Double click the variable in the Variables panel.
  • If you are working on a topic containing the variable, right click in the variable and select Edit Variable from the context menu. You can also remove it using the context menu.

Formatting Variables

If you enter a simple string into the variable, it will take on the format of the paragraph it is in. In the Authoring panel, an unfomatted variable will show in green, as with any field. In the output, it will have the normal <p> tag applied unless you override it.

In the above example there is a requirement for "Warning" to be in red in some instances. 

If you want to format any or all of the variable, then apply styling as shown here.

 "Warning - Red" has to be written as you see it above. If you are not sure what HTML is required for your variable, create it in a topic, switch to code view and copy/paste it from there.

In the output, the above examples will display as shown here.

Variable Sets

Having created your variables with their default values, the next stage is to create the required sets

Let's say the default values are for US users and values are required for two more markets the organization operates in. Click the Settings icon to open this dialog and enter the required value, then click the + icon so that the set name appears below as shown.

Click Done to close the dialog and then select a set in the dropdown. Initially that will show the default value. Change that to the required value. Change all the values for that set and then repeat the process for all the sets you require.

Later if you tick the check boxes, a Reset button allows you to revert any of the values to the default values so that you can start again.

The dustbin icon allows you to remove a whole set.

Generating an Output

When you generate an output you must select one set. You can either change the set each time you generate or create duplicate presets each with a different set selected.

Excluding a Variable

It may be that you need a variable in a topic but don't want it when certain sets are generated. To achieve this, exclude the variable and any adjacent text using a Condition Tag and Condition Expression.

Donations

If you find the information and tutorials on my site save you time figuring it out for yourself and help improve what you produce, please consider making a small donation.