Action Descriptions: Decision Branch

To execute actions depending upon current conditions, add a Decision Branch action to your event. A decision branch action consists of at least one rule, and at least one condition test. If the condition test meets the rule, the branch evaluates to "true," and the event continues by executing the subsequent action. To access this action in the Event editor, choose the Basics button from the Actions list.

Decision Branch Procedures

Decision Branch Example

There are many ways to use conditional logic in an application. As an example, suppose you were tasked with creating a banking application to be used internally by the tellers. The tellers can interact with client accounts, making balance transfers or buying new CDs. Let's say that you want to prevent tellers from making major transactions, reserving this capability for managers. To do this, you could add a Decision Branch action to an On Form Submit event, for an interactive form that compares all of the input fields to a maximum number, and then navigates the user to a different form for manager login.

To build this example with a Decision Branch, you could use the rule "When at least one is true," with a condition test for each input field, comparing it to a variable containing the maximum amount you will allow for teller-initiated transactions. If an input field exceeds this number (use the "Greater than" operator in your expression), the branch evaluates to true and the sub-action is processed. The sub-action would be a Display Form, navigating the teller to a different form for manager login. If none of the input fields exceeded the maximum, the branch would evaluate to false, the sub-actions of the branch would not be processed, and the application would continue.

Decision Branch Properties

Property Description
Name This optional property can help with identification when you use multiple decision branches.
Expression Type (Rule) This is the statement that must evaluate to true for the event to continue. For example, the "all" in the statement "When all are true" refers to all of the condition tests added to the expression. Click the Add Rule button to select an expression type. Options include:
  • When all are true
  • When at least one is true
  • When all are false
  • When at least one is false
Condition Tests To evaluate a condition, you build a test that compares two operands. The operands can be fields on a host screen, constants you define, values of controls on a form — basically, any of the data elements available to your application at that time.

Either operand can be compared with a constant that you define, by right-clicking the selected data element and choosing Compare with Constant. When using constants, do not use the following characters: +, -, \, /, (, ), or '. (The expression evaluator handles these characters in a particular way; therefore, they cannot be used as part of the constant values in a test condition of a decision branch step.)

Operator The operator used to compare the operands. Select from the following. (Default: equals.)
Operator Name
Operator
equals ==
Not equals !=
Less than <
Greater than >
Greater than or equals >=
Less than or equals <=
like like
Note If you are using the like operator, include a wildcard character (*) in the operand to which you are comparing a control value. For example, if your control values are abc, abd, and abe, you would get the following results:
If the
control value is
   The expression
evaluates to
like 'b' false
like 'ab' false
like 'ab*' true
like '*b*' true
Type The data type of the selected operands. Select either String or Number. (Default: String.)

If the type is String, for example, the statement "10.0" > "10" is true. However, it will evaluate as false if the type is set to Number.

Related Topics
Bullet Adding Actions to Events
Bullet Adding Decision Branches to Events
  Attachmate