Mixed Operations (Magic xpa 3.x)
A mixed operation is one in which a server-side operation or expression is used in conjunction with a client-side operation. There are a few situations in which this may arise:
-
A client-side operation, such as Verify, uses a server-side function in one of the expression properties for the operation, such as the operation condition. (As seen in the F10 event above.)
-
A server-side operation uses a client-side function in one of the properties, such as the condition expression. (F11 event above)
-
Mixed expression: A single expression may need to use both client-side and server-side functions. (F12 event above)
In these cases, you will get an error message from the syntax checker.
When we have mixed operations, it would require execution on both the client and the server within the same operation and even within the same expression. This has been blocked by Magic xpa in order to minimize the inherent performance issue.
To implement any of the above scenarios, you need to use more than one operation as follows:
-
Define a new variable.
-
Update the variable with the relevant function's value. The variable should be updated wherever it makes the most sense – in a sequence of operations that are on the same side as the expression. It is good practice to place the Update operation in the same sequence of operations as other operations that will be executed at the same place (server or client) in order to minimize the network traffic.
-
Use the new variable in the expression instead of the function.
In our example, we have a variable, v.Is a weekend, which is updated in the Task Prefix with a CallProg(). This gets used by the F10 handler, which is now purely client-side.
Another variable, v.Client report has been run, is updated in Record Prefix. That allows the Call Program in F11 to be purely server-side.
Similar logic is used for the Mixed expression used in F12. The original expression was Mixed, and so marked with an M.
In our updated version, we hold the ClientFileExist() function result in a variable, which is updated in Record Prefix (or wherever is convenient on the client side). This makes the expression purely server-side, so it works.
|
Note:
To repeat: If you are unsure if a given function is client-side, server-side, or either, look in the function list. When the function is displayed, the Side is listed on the lower right.
|