This article concentrates on clarifying the use of the percentage sign and how they relate to the embedded expression evaluator.

A percent sign is used as a special character in Automate to indicate the beginning and end of an expression. For example: %1+1% inside a task will resolve to 2 at runtime. To send a literal percent sign simply escape the percent character.

Example:

  • To send the text "5%" specify "5%%"
  • At runtime the double percentage signs will be recognized and converted into one.
  • Doubling the percent sign is known as "escaping the percent sign."

Concatenating Two Values in an Expression

In some cases, it is necessary to concatenate two variables, functions, or some combination thereof. In this case it is critical to remember that two percent signs always mean a literal percent. So the following will not work:

%variable1%%variable2% (NOT ALLOWED)

At runtime Automate would actually see the following "expression":

variable1%variable2

Which would result in a Syntax Error. The proper way to combine two values in an expression is to use the ampersand (&) character as follows:

%variable1 & variable2%

This will properly concatenate the two values.

A common misconception is that percentage signs are required anytime a variable is used. This is not always the case because percentages surround expressions which may or may not contain variables. For example, in situations wehre Automate requires a variable name (for example, in the Set Variable action), only the variable name is required. It is permissable, however, to use an expression to specify the variable name so the resolved variable is used.

For example, assumed we have two variables: one called Name with an initial value of Scott. If we wanted to change the value of "name" from Scott to Muscle, we'd use a Set Variable statement such as this:

<AMSET VARIABLENAME="Name">Muscle</AMSET>

If we add another variable called NameVariable and set it's initial value to Name, we could set the Name variable to Muscle as we did above by using an expression:

<AMSET VARIABLENAME="%NameVariable%">Muscle</AMSET>

This is because at runtime the %NameVariable% expression will be evaluated to Name before the Set Variable action is executed.

Expressions provide a powerful means of enhancing and expanded the capabilities of your automated processes. Next month we'll explore how to enhance string capabilities in Automate through the use of regular expressions.

Applies to: Automate 10

Still have questions? We can help. Submit a case to technical support

Last Modified On:
You don't have the appropriate permissions.
No, open a new Support Case