Percent Signs in AWE
A percent sign is used as a special character to indicate the beginning and end of an expression. This allows variables, constants and other expressions to be entered in any parameter of a task's properties that accepts expressions. For example: %1+1% inside a task will resolve to 2 at runtime. Below are some common scenarios which involve the use percent signs.
Sending Literal Percent Sign
To send a literal percent sign, escape the percent character. Doubling the percent sign is known as "escaping" the percent sign. For example, to send the literal text 5%, specify 5%%. At runtime the double percentage signs will be recognized and converted into one.
All percent signs are recognized and evaluated by Advanced Workflows that are contained in any parameter that accepts expressions. For example, if an 'Open Webpage' action contained the URL:
http://m
During runtime, Advanced Workflows will detect the percent signs contained in the URL (%admin%) and automatically classify admin as an expression, which eventually fails the task with the error "A variable in the expression does not exist or is misspelled". In such cases, doubling the percent signs will resolve the issue as shown below:
http://
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%
(INCORRECT)
At runtime, Advanced Workflows would actually see the expression as 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%
(CORRECT)
Common Misconception
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 where Advanced Workflows requires a variable name (e.g., in the 'Set Variable' action), only the variable name is required. It is permissible, however, to use an expression to specify the variable name so the resolved variable is used.
For example, assume we created a named Var1 with an initial value of Scott. If we wanted to change the value of this variable from Scott to Muscle, we would use a Set Variable action with the properties shown below.
If we add another variable named Var2 and set its initial value to Var1, we could set the Var1 variable to Muscle as we did above by using the expression shown below.
This is because at runtime the %Var2% expression will be evaluated to Var1 before the Set Variable action is executed. The code that executes this example is below.
<AMVARIABLE NAME=Var1Scott/
<AMVARIABLE NAME=Var2Var1/
<AMSET
NOTE: The code can be copied and pasted directly into the Steps pane of the Task Builder.
See Also