If/End If Action

Description

Begins and ends a block of steps that are executed conditionally. "If" is an extremely useful action. It allows decisions to be made during the execution of the Workflow depending on the result of an expression evaluation. Some examples of simple (although impractical) expressions are: as 1=1 (true). Or 1>2 (false).

The kinds of expressions more likely to be used in the "If" action are: city = "Los Angeles" or count = 100. If the result evaluates to TRUE, Automated Workflow will execute the block of steps immediately following the If action until an End If is encountered; otherwise the block will be skipped (or if an Else <AMELSE> statement is encountered it will execute that block of steps). All If actions must be followed at some point with an End If <AMENDIF> to mark the end of the code block that is to be executed if the expression is true. The End If action has no parameters.

You can put percentage signs around the expression, but this is not required.

Declaration

<AMIF EXPRESSION="text"></AMIF>

Examples

<!-- A simple useless test - should result to true--->
<AMIF EXPRESSION="%1 = 1%">
  <AMMESSAGEBOX MESSAGETEXT="the result was true">
</AMIF>

 

<!-- Another useless test with AMELSE - should result to false--->
<AMIF EXPRESSION="2 = 1">
  <AMMESSAGEBOX MESSAGETEXT="the result was true">
<AMELSE>
  <AMMESSAGEBOX MESSAGETEXT="the result was false">
</AMIF>

 

<!-- Check if it is Friday! Using functions and AMELSE - in this example it will only work if it is actually Friday--->
<AMIF EXPRESSION="Day (Now()) = 5">
  <AMMESSAGEBOX MESSAGETEXT="It's Friday">
<AMELSE>
  <AMMESSAGEBOX MESSAGETEXT="It is not Friday. Lame.">
</AMIF>

General Tab Parameters

Simple or Complex: Specifies the parameters to compare. Click the Expression Builder icon to build and insert an expression. Click the list to specify the logic of the comparison: is, is not, is greater than, is less than, is greater than or equal to, is less than or equal to.

Text, Optional
MARKUP: EXPRESSION="1 > 2"