If - Else

Declaration

<AMELSE />

Related Topics   

Description

Used along with any If activity to provide an alternate code block to execute only if the condition returns FALSE.

NOTE: All If activities must be followed at some point with an End If step to mark the end of the code block that is to be executed if the expression is TRUE. For ease of use, by default, any If activity added to the Task Builder's Steps panel is always followed by an End If activity.

Practical Usage

If combined with Else is an extremely useful combination. These activities are conditional statements that can perform different actions during the course of a task depending on the result of an expression evaluation. If the result evaluates to TRUE, the task will execute the block of steps immediately following the If activity up until an End if step is encountered, otherwise the block will be skipped (or if an Else statement is encountered it will execute that block of steps).

Parameters

(This activity contains no parameters)

Description

Error Causes

On Error

Example

NOTE:
  • The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

Description

Simple If / Else Statement that displays the answer in a message box.

Copy
<AMIF EXPRESSION="2 &lt; 1" />
<AMSHOWDIALOG MESSAGE="The result is TRUE." />
<AMELSE />
<AMSHOWDIALOG MESSAGE="The result is False." />
<AMIF ACTIVITY="end" />