Perform alternate actions for true or false conditions
- Position the cursor at the desired location in the rule text area of the Edit Rule dialog box.
- Select If...Then...EndIf from the drop-down list in the toolbar.
- Replace My_expression with the first expression to evaluate.
- Enter the action to perform if the condition is true, on the line between the If-Then statement and the EndIf statement.
- Leave your cursor at the end of the action you just entered, and select Else from the drop-down list.
- Enter the action to perform if the condition is false, on the line between the Else statement and the EndIf statement.
When you enter the actions to perform, you can use the choices in the Snippets area to insert a function at the cursor location. You can then add the appropriate arguments for the function.
Note: You can also enter any of the text described in these steps manually; however, using the drop-down lists and snippets can reduce mistakes.
Perform action only if one condition is true
- Position the cursor at the desired location in the rule text area of the Edit Rule dialog box.
- Select If...Then...EndIf from the drop-down list in the toolbar.
- Replace My_expression with the expression to evaluate.
- Enter the action to perform if the condition is true, on the line between the If-Then statement and the EndIf statement.
When you enter the action to perform, use the choices in the Snippets area to insert a function at the cursor location. You can then add the appropriate arguments for the function.
Note: You can also enter any of the text described in these steps manually; however, using the drop-down lists and snippets can reduce mistakes.
Perform no action for condition
- Position the cursor at the desired location in the rule text area of the Edit Rule dialog box.
- Select If...Then...EndIf from the drop-down list in the toolbar.
- Position the cursor between the two inserted lines, and select Else from the drop-down list.
- Replace My_expression with the expression to evaluate.
- <recommended> Enter a comment, such as ‘do nothing, to replace what would normally be an action in the statement.
- Enter the comment at the end of the If-Then statement to perform no action if the condition is true.
- Enter the comment after the Else statement to perform no action if the condition is false.
- Enter the action to perform for the true or false condition, depending on which condition is to include the action.
When you enter the action to perform, use the choices in the Snippets area to insert a function at the cursor location. You can then add the appropriate arguments for the function.
Note: You can also enter any of the text described in these steps manually; however, using the drop-down lists and snippets can reduce mistakes.
Perform alternate actions for more than two conditions
- Position the cursor at the desired location in the rule text area of the Edit Rule dialog box.
- Select If...Then...EndIf from the drop-down list in the toolbar.
- Replace My_expression with the first expression to evaluate.
- Enter the action to perform for the condition, between the two lines.
- With the cursor at the end of the action you just entered, select ElseIf...Then from the drop-down list, and replace My_expression with the next expression to evaluate.
- Enter the action to perform for this condition, on the blank line below the condition.
- Repeat the previous two steps as many times as necessary to accommodate the remaining conditions.
When you enter the actions to perform, use the choices in the Snippets area to insert a function at the cursor location. You can then add the appropriate arguments for the function.
Note: You can also enter any of the text described in these steps manually; however, using the drop-down lists and snippets can reduce mistakes.
Perform alternate actions based on comparison to test case
Select Case <test expression>
Case <expression list 1>
<statement list 1>
Case <expression list 2>
<statement list 2>
Case Else
<statement list n>
End Select
- Position the cursor at the desired location in the rule text area of the Edit Rule dialog box.
- Select Select Case from the Keywords drop-down list in the toolbar.
- Add a space at the end of the statement you inserted, and then enter the test expression.
- Press Enter, and select Case from the Keywords drop-down list in the toolbar.
- Add a space at the end of the statement you inserted, and then enter the first expression to compare against the test expression.
- Enter the action to perform for this condition, on the blank line below the expression.
- Repeat the previous two steps as many times as necessary to accommodate each expression.
- Position the cursor on a blank line below the last expression, and select Case Else from the Keywords menu.
- On the blank line below the statement you inserted, enter the final Case clause to trap unexpected results, and press Enter.
- Position the cursor on a blank line below the last expression, and select End Select from the Keywords menu.
When you enter the actions to perform, use the choices in the Snippets area to insert a function at the cursor location. You can then add the appropriate arguments for the function.
Note: You can also enter any of the text described in these steps manually; however, using the drop-down lists and snippets can reduce mistakes.