How Do I Condition the Execution of an Operation Based on a Variable’s Value? (Magic xpa 3.x)
You have a lot of control over the execution of an operation in Magic xpa. Basically any Boolean operation you can think of can be entered as an expression. In this example, we will enter an expression that makes an error message occur if a certain field is left blank when the user leaves the field.
-
Go to the operation you want to have a condition on. In this example, it’s a Verify Error operation.
-
Tab to the Cnd: column at the far right of the operation.
-
Zoom (F5 or double-click). This will bring you to the Expression Rules.
-
Press F4 to open up a line. You will now be parked on a blank line.
-
Zoom (F5 or double-click) again, which will bring up a list of variables. You can select a variable by:
-
Type in the rest of the expression as needed.
The expression should evaluate to TRUE when you want the operation to execute. You can think of the Cnd: column as being an “IF”. If the condition is true, the operation executes. In this example, B= ‘’ will be TRUE if B is blank, and then the user will get the Verify error message.
The Expressions chapter
The Online and Rich Client Samples projects (program LG07 and RLG07)