How Do I Create Operations in a Task? (Magic xpa 2.x)
In each logic unit, there are lines of operations. You create an operation by:
-
Pressing F4 on the line above where you want the operation.
-
Selecting the operation by typing in the shortcut letter, or selecting it from the pulldown list.
-
Continuing to fill out the operation according to what it does.
There are 8 operations you can enter. Here is an overview of how to enter each one.
All the operations have a Cnd (condition) field at the end. This is basically an “if” statement. If the Cnd is “yes” or it points to an expression that evaluates to true at runtime, then that operation will be executed.
-
If the Cnd is Yes, the operation always executes.
-
If the Cnd is No, the operation never executes.
If the Cnd is a number, it points to the expressions rules. To enter a condition expression, just zoom from the Cnd field, type in the expression, and press Enter to bring back the expression number.
The Update operation is equivalent to the assignment operator in many languages. It copies the data from an expression into a variable.
The Call operation is how you execute another Magic xpa task. You have different options, depending on what you want to do. For instance, Call Program calls another program in the Program repository, by number. Call Subtask calls only subtasks of this program. Call By Name calls programs by their public names.
The Argument list is used if the called program is expecting parameters. Similarly, the Result: field allows you to enter a variable to catch any return value the program sends.
Invoke is what you use to call programs that are not in Magic xpa. You can call operating system scripts, web services, COM objects, and more. Each of these is entered a little differently, by changing the settings in the operation properties.
The Raise Event operation does just that: it raises an event. The event it raises will be handled in the same way as if the user had pressed a key (system event) or an event was raised by a push button.
Evaluate is used to execute expressions that may not set any variables. For instance, here we are executing a FileDelete().
The Block operation is used to group operations, as the block operator does in most computer languages. Here we have a Block if/then/else, based on a return code from a report.
There are two kinds of Verify operations:
-
Verify Warning gives a message to the user.
-
Verify Error gives a message to the user, but also stops processing from continuing, until the error is fixed.
Verify Warning is handy, but Verify Error is powerful. Verify Error can stop processing altogether, preventing the user from saving an invalid record. You can learn more about this in How Do I Properly Validate the Data Entered by the End User?.
The Form operator is used to output a form, or to input a form. Typically if you are outputting a form, it is going to be to a printer, for a report, or to a text file to be read by another program (like Excel), or to an HTML file for internet screens. Input forms are usually used to read text files.
The Online and Rich Client Samples projects (program TS21 and RTS21)