Working with Substitution Variables

Substitution variables are used to insert a value that the code can reference. At run time, the actual value replaces a substitution variable. Different variables allow you to determine the text or detail that you wish to insert and at which point.

The commonest use of substitution variables is when formatting the text of alerts sent to the Enterprise Console or Instant Alert to be forwarded as SMS messages or emails.

All substitution variables begin with an ampersand (&) and are usually case-sensitive. When a substitution variable is used, the program searches for an ampersand and if found, compares the following text against a list of valid variables. If a match is made, the existing text is replaced with the substitution variable. Any non-matching text is left in its original condition.

When using substitution variables, any entries that are formed correctly are highlighted in green and those that will result in an error are highlighted in red.

EXAMPLE: In the following use of substitution variables:

 

‘User &NA is not authorized to file &FN in folder &FL’

 

where:

  • &NA equals User Name
  • &FN equals File Name
  • &FL equals Folder Directory and Name

may produce the following text:

 

‘User John is not authorized to file Payroll.dat in folder C:\Program Files\

Retaining an ampersand in the existing text

If an ampersand is already present in the existing text to be retained when using substitution variables, simply insert a double ampersand to instruct the program that you wish to retain the original entry instead of using a substitution variable.

EXAMPLE: An example of how this works in practice can be seen below:

 

‘Drives C, D &&E are working normally’ would result in

 

‘Drives C, D & E are working normally’.

Related Topics