Basic syntax

Variable name

In its simplest form, a variable is specified as follows:

[Group.Variable]

The variable name is surrounded by square brackets. Whitespace is not allowed in the variable specification.

Variable names contain two segments separated with a period. The first segment is the group name; the second segment is the variable name within the group.

Arguments

Some variables can contain arguments that help determine the variable's dynamic value. Arguments are specified as follows:

[Group.Variable:ArgumentName1="Value",ArgumentName2="Value"]

In this example, two arguments are defined with names "ArgumentName1" and "ArgumentName2". If a variable has arguments, the variable name is followed by a colon which is followed by the arguments. For each argument, the argument name is followed by an equal sign and the value of that argument between single or double quotes. The value can contain single quotes if it is double-quoted, or double quotes if it is single-quoted. A comma separates the arguments if there is more than one. A variable specification must not contain any whitespace except when required in a quoted argument value.

Nested variables

The Expression argument of the [Switch.Calculation] variable and the SQL arguments of Database variables can contain nested variables. These variables are used to define the value of the argument.

[Group.Variable:ArgumentName1="[Variable1]"]

Nested variables have the same syntax as the regular variables and are always surrounded by square brackets.

Some examples:
  • [Switch.Calculation:Expression="[Job.Size]"]
  • [Database.TextIndexed:SQL="SELECT JobName FROM Jobs",Connection="DBConnection",Separator=", "]
  • [Database.Text:SQL="SELECT JobName FROM Files WHERE FileName='[Job.Name]'",Connection="DBConnection"]
Note: Nested variables are not allowed in other types of arguments. If you use them, they will be ignored and treated as regular text.

Nesting can be multi-level, i.e. nested variables can contain other nested variables.

Example:
  • [Database.Text:SQL="SELECT PublisherName FROM Jobs WHERE JobName='[Database.Text:SQL="SELECT JobName FROM Files WHERE FileName='[Job.Name]'",Connection="DBConnection"]'",Connection="DBConnection"]

    (where the nested variable [Job.Name] is included in the variable [Database.Text:SQL="SELECT JobName FROM Files WHERE FileName='[Job.Name]'",Connection="DBConnection"])

Note: If used in an argument that supports nested variables, the opening square bracket '[' is interpreted by Switch as the beginning of a new variable. To use the square bracket as static text, you need to double it: '[['. Note that there is no need to double the closing square bracket.
Example:
  • If there is a variable [Database.Text:SQL="SELECT [[JobName] FROM Files WHERE FileName='[Job.Name]'",Connection="DBConnection"]
  • For a job with the name TestFile.pdf, the SQL request SELECT [JobName] FROM Files WHERE FileName='TestFile.pdf' will be executed.

See also: