The script language allows developers to create his own application business
logic. It has many particulars similar to other script languages, such as Java
Script, that makes it easier for mastering by beginning developers. Besides,
Designer includes Syntax Assistant and context help (drop-down lists) that
significantly speeds up creation of modules and reduces the number of mistakes
in the code.
A fragment of the script language code
Here are some of the major features of 1C:Enterprise 8 script language:
Pre-compilation. The script code is pre-compiled into internal code.
Caching of compiled modules in memory.
Variable type is defined with its value, and it can change on runtime.
Absence of programmatic description of configuration objects; developers
use either objects provided by the framework, or those created by the system
as a result of visual designing of the applied solution.
Execution of the script language modules is event-driven. It means that
modules are executed upon some events occur during applied solution execution.
Event handlers in Delivery document
object module
For example, there is a Delivery document in a configuration whose
functioning implies using a number of events, including BeforeWrite event. This
event is thrown immediately before the document data is written to the database.
Developers can specify algorithms in the event handler to check the entered data
for correctness.
The Script
Language on the Client Side
When running in client-server environment, most of functionality is provided
by the server side (See 'Client-server interaction model' section). Although
operation of the script language on the client side is possible, its
functionality is limited.
It's used when it's necessary to make some calculations related to the form
displayed. For example, to calculate quickly an item amount basing on its price
and quantity; ask user a question and process his answer; get a local file and
send it to the server, etc.
Client procedures are explicitly separated from server's ones, they use only
limited set of the script language's object model.
Code running explicitly at client or
server side
It is not allowed for client to access a database directly. Client side code
cannot interact directly with applied objects; for example such objects as
CatalogObject.<name> are not available in the client side code. Queries are not
available either. If it's necessary to operate with data, the client code should
call corresponding server procedures that will access required data.
The Query Language
To provide a developer with a way to use queries to implement his own
algorithms 1C:Enterprise 8 framework includes a query language. The query
language is SQL-based, but contains significant extensions focused on business
character of tasks it is intended for and to minimize efforts required for
business application development.
The most significant features of the query language are the following:
Access to fields through ‘.’ (dot). If some table fields are of reference
type, a developer can reference to them using ‘.’ (dot). The number of
nested references is unlimited.
Access to nested tables (tabular parts of documents).
Auto-ordering.
Multi-dimensional and multi-layered totals.
Virtual tables support. The virtual tables provided by the framework allow
getting almost ready data for most applied solutions without using
complicated queries. For example, such a virtual table can provide balance
data by periods at a certain point of time. At that, virtual tables
extensively use information stored before, for example, totals calculated
earlier.
Standard SQL-operations, such as Union, Join, etc.