clientExecution Option
The clientExecution method option causes the method to be executed on the standard client or application server node. Methods that are called by the clientExecution method that do not specify the execution location continue to be executed on the standard client of application server node. When the clientExecution method completes, execution returns to the node or the browser from where the method was called.
If the method is called from a method executing on a server node, it enables windows on the client to be updated (for example, progress bars).
The method in the following example iterates through 5000 entries in the Number collection, and executes using the clientExecution method option.
executeOnClient() updating, clientExecution; vars num : Number; begin // When this method was tested on a presentation client in JADE // thin client mode, it took 4.277 seconds to execute, as the // method has to download the appropriate entry from the server // database at each iteration. beginTransaction; foreach num in numbers do num.key := 0; endforeach; commitTransaction; end;
The method in the following example iterates through a collection of clients adding each client’s name to an array, and executes using the clientExecution method option.
getAllOperators(): StringArray clientExecution; vars client : Client; company : Company; result : StringArray; begin company := Company.firstInstance; if company <> null then create result transient; foreach client in company.allClients do result.add(client.name); endforeach; endif; return result; end;
See also "Server and Client Execution Restrictions" and the example under "serverExecution Option", later in this chapter.