1C:Enterprise 8.3. Practical Developer’s Guide. Lesson 5 (2:00). Theory. Script execution on the client and on the server

Script execution on the client and on the server

In the previous lesson you created a single procedure for handling multiple events and stored it to the common DocumentProcessing module. In particular, you set the Client (managed application) check box and cleared the Server check box in the module properties. The procedure is called from the form module where the event handler also has a directive that specifies the execution context for this handler: &AtClient. Now we will explain how script is executed in this scenario.

When an application is started, script execution is always started on the client. Then the script execution can be passed to the server by calling a procedure of a common module compiled on the server.

When a procedure or function is called, the platform searches for it on a client first. If the compiled client context does not contain this procedure, the search continues on the server. If the procedure is found, the script execution is passed to the server. When the procedure is execution is completed, the script execution continues on the client.

For example, when you change a price in a goods receipt form, the PriceOnChange() procedure of the form module is called. It is executed on the client in the thin client mode. The second line of this handler calls the CalculateTotal() procedure. This procedure is located in the common DocumentProcessing module, which is also compiled on the client. It is executed in the thin client mode. Once the procedure is executed, the execution is passed back to the form module (fig. 5.49).

Lesson 5 (2:00). Theory / Script execution on the client and on the server
Fig. 5.49. Passing script execution between client modules

Leave a Reply

Your email address will not be published. Required fields are marked *


1C:Enterprise Developer's Community