Assign an empty string to variables - Cloud

Variables

With variables, you can insert a blank value into the published output. This applies to both text and file object type variables.

To borrow from an earlier example in Text Variables, you may want to publish a generic version of the equipment manual with no company name. For this book you make an assignment to the <company_name> variable that has an empty value. When published, the company name variable will effectively disappear.

Empty variables and white space

Bear in mind that when substituting nothing into a stream of text, you may end up with some unexpected white space. For example, this might occur if a variable used at the end of a sentence is substituted with nothing. In the published output you now end up with the "space" before before the full stop.

When the extra space might cause problems, it is recommended that you include any required spacing in the variable value so that when the value is substituted the white spacing always looks as you want it.

Example

In this example instructions are being given for returning faulty equipment. Depending on the manual, the equipment will have to go back to the store where it was bought or sometimes to the manufacturer.

The text in the reads "Return the equipment directly to the store<return_location>."

Note that in the text there are no spaces between the word "store", the variable, and the full stop.

Topic Text with Variable

The two values are set to "[empty string]" or "[space]or Acme Teleporters":

"[empty string]"

Blank Variable Value

"[space]or Acme Teleporters"

String Variable Value

After publishing, depending on the variable value chosen, the sentence will read either:

  • "Return the equipment directly to the store." - when the value with the empty string is used. Note that this option does not display any extra white space before the full stop.

    or

  • "Return the equipment directly to the store or Acme Teleporters." - when the Acme Teleporters value is used.