Using AMCondition

A Condition can trigger the start of a workflow upon the occurrence of particular event or when the specified condition is met. In such cases, an AMTrigger dataset is automatically created which can be used within steps of the task to determine specific trigger and system elements, such as when the task was triggered, what object triggered the task, which machine ran the task, whether that machine was locked or logged off during task execution, etc.

Unlike events which trigger the start of a workflow or task based on an occurring event, a condition affects a workflow based on a specific condition (i.e. situation, state or circumstance) being met, therefore, a condition can exist in any segment of a workflow. In such cases, AMCondition must be used in place of AMTrigger. In other words, when an event or condition is used to trigger the beginning of a workflow or task, an AMTrigger dataset is obtainable. When a condition is used in all other cases, an AMCondition dataset becomes available.

The Behavior tab located in each condition's properties determine whether the object will be used as a triggering or non-triggering element during runtime. The parameter labeled Wait for condition along with the option indefinitely are toggled by default allowing the condition to act as a triggering element. Thus, AMTrigger datasets are created and accessible only when the option to wait for a condition indefinitely are selected. When all other Behavior tab parameters are selected, the AMCondition dataset becomes available instead.

For example, the workflow illustrated below contains two File conditions, each set to monitor for a particular file to exist. The File condition located in the beginning of the workflow is used to trigger the launch of the workflow upon the existence of File A. When this occurs, an AMTrigger dataset is created and populated. Another File condition is located in the middle of the workflow used to pause execution and wait for File B to exist before proceeding. When this condition is activated, an AMCondition dataset is created and populated with the proper values instead. Additionally, a Window condition is used in the middle of the workflow to determine whether Notepad exists. Since this condition resides in the middle of the workflow, an AMCondition dataset becomes populated upon activation of this condition as well.

AMCondition is a standard AutoMate dataset and can be used much like the datasets created by the SQL Query, and Get E-Mail actions. The fields of AMCondition can be used to examine characteristics of the condition that initiated during the course of a workflow. For example, using a 'Message Box' action with the Message to display parameter set to:

%AMCondition.Agent%

would display a message dialog during runtime that shows the name of the agent that the task was executed on.

The AMCondition dataset elements that are created when a non-triggering AutoMate condition occurs are comparable to the AMTrigger dataset elements created. The only difference is the syntax. For example, to return the filename that caused a 'File' condition to start a task, the dataset AMTrigger.FileName is used. When the same 'File' condition is used in the middle of a workflow, AMCondition.Filename is used.

Standard AMCondition Parameters

Each Event or Condition contains its own set of unique AMCondition values. Therefore, the total number of fields that AMConditon creates during runtime and what they are called depend largely on the condition that was activated. However, every instance of AMCondition is populated with the following general fields:

Name

Data Type

Return Value

AMCondition.Agent

String

Returns the name of the agent where the condition activated.

AMCondition.DateTime

String

Returns the date and time of when the condition occurred.

AMCondition.Name

String

Returns the name of the activated condition. Each condition contains a unique name. For example, if the File condition was initiated, the value returned would be . See the help topic for each condition to determine that object's unique name.

AMCondition.Result

String

Returns the result of the activated condition (True or False).

AMCondition.WasLocked

Boolean

If the workstation was locked when the condition occurred, the value returned is 1. Otherwise, it will be 0.

AMCondition.WasLoggedOff

Boolean

If the workstation was logged off when the condition occurred, the value returned is 1. Otherwise, it will be 0.

AMCondition.AML

String

Returns verbose data about the activated condition in AutoMate Markup Language (AML) format.

 

NOTE: NOTE: A full list of AMCondition and AMTrigger objects exclusive to each Event/Condition can be viewed from the Expression Builder dialog box by expanding the Objects folder.

See Also

Using AMTrigger

About Conditions

All Available Conditions

Setting Conditions

Datasets