Preprocessor instructions


Preprocessor instructions are used to specify the place where the code will be executed. Without the Preprocessor instructions, the code will be executed anyway (At Server, At Client, etc.) Instructions can be given for procedures (functions) as a whole or for individual sections of program code. Here is the syntax:

   #If <Logical expression> Then
   <Source Code>
   #ElsIf <Logical expression> Then
   <Source Code>
   <Source Code>


   <Logical expression> = [ NOT ] <Preprocessor keyword>[<Boolean operation> [ NOT ] <Preprocessor keyword> [<Boolean operation> [ NOT ] <Preprocessor keyword>]]   <Preprocessor keyword> = { AtClient | AtServer | ThickClientOrdinaryApplication | ThickClientManagedApplication | Client | Server | ExternalConnection }   <Boolean operation> = { AND | OR }

And the Keywords:



1)     We can Group lines and collapse them in the Script Module:

#Region [<Region name>]
<Source Code>

Regions instructions do not have any effect on the application. instructions cannot overlap with module parts marked with other instructions. These instructions can be nested to describe nested regions.

2)     If the client/server mode of 1C:Enterprise, you can specify whether specific procedures and functions are executed on the application server or on the client workstation.

a.  For execution on the server (the Server and AtServer instructions are equivalent):

#If AtServer Then
<Source Code>

b. For the procedure to be available for calling on the server side:

#If Server Then 
Procedure Proc1() Export 
<Source Code>

In the ordinary client (both in ordinary and managed modes) the following preprocessor instructions are available: AtClient, ClientThickClientOrdinaryApplication, ThickClientManagedApplicationAtServer, and Server.
In the file mode the preprocessor instructions #If Server#If Client#If ThickClientOrdinaryApplication, and #If ThickClientManagedApplication are always defined, so a code instance is always available.
In the thin client the following instructions are available: ThinClientAtClient, and Client.
In the back end of the thin client the following instructions are available: Server and AtServer.
In the external connection, the following instructions are available: ExternalConnectionAtServer, and Server.

Be the first to know tips & trick on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.