Compilation directives

Each procedure or function of a managed application form module, command module, or common module is preceded by a compilation directive that sets up the environment for the procedure execution. A directive is preceded by & character. The following directives are available:

  • &AtClient. A client-side procedure or function.
  • &AtServer. A server-side procedure or function.
  • &AtServerNoContext. A server-side procedure or function executed on the server outside of the form context. Variables cannot be out-of-context. The form context (including form data) is not available to such methods. Only the calls of other out-of-context methods are allowed. When these methods are called, the form data is not sent to the server and not received from the server. Using out-of-context methods significantly reduces the amount of traffic when a server-side procedure is called from the client-side application environment.
  • &AtClientAtServerNoContext. A procedure or function executed in a form module on the client and on the server, which does not have access to the form context, form data, and form variables, but has access to procedures and functions of common modules, which are server, not global, and server and client simultaneously. The procedure or function itself is available for client and server procedures and functions of the form module executed inside and outside of the context. Calling server-side methods of common modules from server-side out-of-context form methods is allowed.
  • &AtClientAtServer. A procedure or function executed in a command module on the client and on the server, which has access to procedures and functions of common modules, which are server, not global, and server and client simultaneously, but does not have access to variables. The procedure or function itself is available to client and server procedures and functions of the command module.

A client-side procedure or function is executed in the client application environment. In this procedure, the client context of the form and calls of any procedures of this module are available.

A server-side procedure or function is executed in the server application environment. In such a procedure, the form data, the server context of the form and calls of any server-side and server-side with no context procedures of this module are available. When such a procedure is called, the form data is sent from client to server and back when the call is completed.

A server-side procedure or function executed outside of the form context (an out-of-context procedure) is executed in the server application environment. The form context (including form data) is not available to such procedure or function. Only the calls to other server-side out-of-context procedures or functions are allowed. When these procedures or functions are called, the form data is not sent to the server and not received from the server. Using out-of-context methods significantly reduces the amount of traffic when a server-side procedure is called from the client-side application environment.

If a procedure or function is not preceded by a compiler directive, it means that the default directive is used. The default directive is &AtServer. It is not allowed to use multiple compiler directives preceding the same procedure or function. It is not allowed to have multiple procedures or functions with the same names differing only in compiler directives that precede them.

Preprocessor instructions can be used in a managed form module. It is recommended that you use the preprocessor instructions only within procedures or functions. To understand the possible results in case when the preprocessor instructions cross the procedure (function) boundaries, you should take into account that the preprocessor instructions are processed before compiler directives.

The predefined ProcessCommand() handler in a command module must be preceded by the &AtClient compiler directive because the command is executed in the client application.

Form module
  In a form module, &AtClient, &AtServer, &AtServerNoContext, and &AtClientAtServerNoContext compiler directives are available.
Command module
  In a command module, &AtClient, &AtServer, and & AtClientAtServer compiler directives are available.
Shared module
  In a shared module, &AtClient and &AtServer compiler directives are available.


    

1C:Enterprise Developer's Community