Variable - Set

Declaration

<AMSET VARIABLENAME="text (variable name)">text (value to set)</AMSET>
OR
<AMSET VARIABLENAME="te">AM125QfdSMYkv0zoNy+RdvlmA==aME</AMSET>

Description: Changes the contents of an already existing variable.

Practical Usage

Variables are used as storage mechanism to store data while a task is running. For more information see Variables. Once a variable is created, its contents can be displayed at runtime by placing the variable name in percent signs (e.g., %myvarname% will automatically be converted it it's contents at runtime).

General Parameters

Property

Type

Required

Default

Markup

Description

Variable name

Text

Yes

(Empty)

VARIABLENAME="thecurrentdate"

The name of the variable to change.

New value

Text

Yes

(Empty

VALUE="The current date is %Now()%"

The value that the variable should be changed to. As with all parameters, this value may be literal or an expression (if surrounded by percent % signs).

Disguise initial value

 

 

 

 

If enabled, the variable's value will be encrypted. If disabled (default), the value will appear unencrypted. This is a visual mode parameter only used during design time, thus, contains no markup.

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Using Variables

All variables must be created before they can be used. This is done using the Create Variable activity. Once created, variables can be set using the Set Variable activity, or by certain actions that support populating variables. To get data out of the variables in any action parameter, simply surround the variable name with percentage % signs (e.g., %varname%). Remember not to use percentage signs when specifying the name of a variable to populate, percentage signs are only needed to get data out.

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Sample 1: A Set variable activity used to change the initial value of an existing variable.

<AMVARIABLE NAME="myVariable">AutoMate</AMVARIABLE>
<AMSHOWDIALOG WINDOWTITLE="CURRENT VALUE">The 
current value of myVariable is: %myVariable%</AMSHOWDIALOG>
<AMSET VARIABLENAME="myVariable">Business Process Automation</AMSET>
<AMSHOWDIALOG WINDOWTITLE="NEW VALUE">The new value of myVariable is:
%myVariable%</AMSHOWDIALOG>
		

Sample 2: A Set variable activity used to populate a value into a variable created with no initial value.

<AMVARIABLE NAME="myVariable"></AMVARIABLE>
<AMSHOWDIALOG WINDOWTITLE="CURRENT VALUE">The 
current value of myVariable is:
%myVariable%</AMSHOWDIALOG>
<AMSET VARIABLENAME="myVariable">Business 
Process Automation</AMSET>
<AMSHOWDIALOG WINDOWTITLE="NEW VALUE">The 
new value of myVariable is:
%myVariable%</AMSHOWDIALOG>

Sample 3: -Variable multiplication - This task describes how to multiply the initial value of two variables using the Set variable activity and display the results in a message box.

<AMSHOWDIALOG>This task describes how to multiply the initial value of two variables using the ‘Set Variable’ action and display the results in 
a message box. This action changes the contents of an already existing variable. As 
with all parameters, this value may be literal or an expression (if surrounded 
by percent signs). This will work with other calculations as well (e.g., addition "+", 
subtraction "-", division "/").</AMSHOWDIALOG>
<AMVARIABLE NAME="var1">30</AMVARIABLE>
<AMVARIABLE NAME="var2">10</AMVARIABLE>
<AMVARIABLE NAME="var3"></AMVARIABLE>
<AMSET VARIABLENAME="var3">%var1 
* var2%</AMSET>
<AMSHOWDIALOG>%var1% multiplied by %var2% results is %var3%</AMSHOWDIALOG>