Developer Guide PDF
Developer Guide PDF
3
Developer Guide
Part 1
Developer Guide
Part 1
Moscow
1C Company
2013
ENTIRE COPYRIGHT TO SOFTWARE
AND DOCUMENTATION BELONGS TO 1C Company
By purchasing 1С:Enterprise software system
you hereby agree to protect rights of 1C Company
and refrain from making copies of the software
and documentation without prior written permission from 1C Company.
PART 1
Introduction.................................................................................................................................1-21
Structure of the Guide............................................................................................................1-21
What You Need To Know......................................................................................................1-23
The Books Included in the Documentation...........................................................................1-23
Training Materials and Additional Opportunities...........................................................1-24
Text Files Included in the 1C:Enterprise 8.3 Distribution Kit.......................................1-24
About 1C:Enterprise 8 Page...................................................................................................1-24
1C:Developer Network..........................................................................................................1-24
Agreed Notation.....................................................................................................................1-25
Chapter 1. Concept of the System.............................................................................................1-27
1.1. Configurability................................................................................................................1-27
1.2. Functioning of the System..............................................................................................1-27
1.3. Basic Concepts of the System.........................................................................................1-28
1.3.1. Configuration Concept..........................................................................................1-29
1.3.2. Configuration Object............................................................................................1-30
1.3.3. Command Interface...............................................................................................1-39
1.3.4. Form......................................................................................................................1-40
1.3.5. Module..................................................................................................................1-40
1.3.6. Template...............................................................................................................1-41
1.4. Operation Modes.............................................................................................................1-42
1.4.1. File Mode .............................................................................................................1-42
1.4.2. Client/Server Mode...............................................................................................1-42
1.5. Development Tools.........................................................................................................1-43
Chapter 2. Work with Configuration.......................................................................................1-47
2.1. Opening Configuration....................................................................................................1-47
2.2. Saving Configuration......................................................................................................1-48
2.3. Closing Configuration.....................................................................................................1-48
2.4. Saving Configuration to File...........................................................................................1-49
2.5. Loading Configuration from File....................................................................................1-49
2.6. Configuration Object Tree..............................................................................................1-49
1-6 1C:Enterprise 8.3. Developer Guide
PART 2
Chapter 13. Business Processes and Tasks.............................................................................2-691
13.1. Major Concepts...........................................................................................................2-691
13.2. General Information....................................................................................................2-692
13.3. Routing........................................................................................................................2-693
13.4. Addressing System......................................................................................................2-693
13.5. Starting Business Processes........................................................................................2-696
13.6. Task Performance........................................................................................................2-697
13.7. Splitting and Joining...................................................................................................2-697
13.8. Manual Control...........................................................................................................2-698
13.8.1. Business Process Completion Attribute............................................................2-698
13.8.2. Task Performance Attribute..............................................................................2-698
13.8.3. Task Removal...................................................................................................2-699
13.8.4. Task Addition...................................................................................................2-699
13.9. Conditional Jump........................................................................................................2-699
13.10. Switch........................................................................................................................2-700
13.11. Task Generation........................................................................................................2-700
13.12. Performance Check...................................................................................................2-702
13.13. Nested Process Execution.........................................................................................2-703
13.14. Business Process Completion...................................................................................2-704
13.15. Standard Business Process and Task Attributes........................................................2-704
13.16. Business Processes with Several Starting Points......................................................2-705
13.17. Feedback....................................................................................................................2-705
13.18. Flowchart...................................................................................................................2-707
13.19. Business Process Editing...........................................................................................2-707
13.20. Task Editing..............................................................................................................2-708
Chapter 14. Data Analysis and Forecasting...........................................................................2-711
14.1. Overview.....................................................................................................................2-712
14.1.1. Main Mechanism Objects.................................................................................2-713
14.1.2. Types of Data Analysis.....................................................................................2-714
14.1.3. Forecasting Models...........................................................................................2-716
14.2. The Summary Statistics Analysis Type......................................................................2-716
14.3. The Association Rules Analysis Type........................................................................2-720
14.3.1. Rules Prune Types............................................................................................2-724
14.4. The Sequential Patterns Analysis Type.......................................................................2-725
14.5. The Decision Tree Analysis Type...............................................................................2-729
14.6. The Сlusterization Analysis Type...............................................................................2-734
14.6.1. Metrics used......................................................................................................2-739
14.6.2. Clusterization methods.....................................................................................2-741
Chapter 15. Data Exchange Mechanisms...............................................................................2-745
15.1. Goals and Objectives...................................................................................................2-745
15.1.1. Universal Data Exchange Mechanisms............................................................2-745
15.1.2. Distributed Infobases........................................................................................2-746
15.2. Universal Data Exchange Mechanisms.......................................................................2-746
15.2.1. XML Documents Read and Write Tools..........................................................2-746
15.2.2. XML Serialization............................................................................................2-746
15.2.3. Exchange Plans.................................................................................................2-759
Contents 1-13
Chapter 20. Temporary Storage Mechanism, Working with Files and Pictures................2-841
20.1. Temporary Storage......................................................................................................2-841
20.2. Working with Files and Temporary Storage...............................................................2-842
20.2.1. Saving Data from File in Temporary Storage..................................................2-842
20.2.2. Data Placement in Temporary Storage............................................................2-843
20.2.3. Data Retrieval from Temporary Storage..........................................................2-843
20.2.4. Data Deletion from Temporary Storage...........................................................2-844
20.2.5. Address Check for Temporary Storage Membership.......................................2-844
20.2.6. Attribute Address Retrieval..............................................................................2-844
20.2.7. File Retrieval from Infobase.............................................................................2-844
20.2.8. Example of File Method Use............................................................................2-846
20.2.9. Enabling Bulk File Operations.........................................................................2-847
20.2.10. Working with Temporary Storage in Background Job..................................2-849
20.2.11. Address Support in Picture Box....................................................................2-849
20.2.12. Access to standard directories.........................................................................2-851
20.3. Specific Features of Using in Web Client..................................................................2-851
Chapter 21. The Event Log......................................................................................................2-853
21.1. Details Management....................................................................................................2-853
21.2. Writing Events.............................................................................................................2-854
21.3. Event Logging Management.......................................................................................2-854
21.3.1. The Access Event Parameters Configuration...................................................2-854
21.3.2. Access Denied Event Parameters Configuration..............................................2-857
21.4. Getting Event Log Records.........................................................................................2-858
21.5. Additional Methods.....................................................................................................2-862
Chapter 22. The Cryptographic Mechanism..........................................................................2-863
22.1. General Mechanism Description.................................................................................2-863
22.2. Main Concepts.............................................................................................................2-864
22.3. General Principles of Using Cryptographic Mechanisms...........................................2-864
22.4. Working with Cryptographic Modules.......................................................................2-865
22.5. Usage Examples..........................................................................................................2-866
Chapter 23. External Data Sources.........................................................................................2-871
23.1. Working with relational external data sources............................................................2-871
23.1.1. Overview...........................................................................................................2-871
23.1.2. General Usage Principles..................................................................................2-873
23.1.3. Editing External Data Source Structure............................................................2-873
23.1.4. Example of External Data Source Table Creation ...........................................2-877
23.1.5. ODBC Connection String.................................................................................2-879
23.2. Working with an external OLAP data source.............................................................2-880
23.2.1. Overview...........................................................................................................2-880
23.2.2. The general principles of usage........................................................................2-882
23.2.3. Editing external data source structure...............................................................2-883
23.2.4. Query Language Limitations When Using
an Analytical External Data Source.................................................................2-886
23.2.5. An OLAP Server Connection String................................................................2-887
23.3. External Data Source Management.............................................................................2-888
23.4. Connecting to an External Data Source in 1С:Enterprise Mode................................2-890
23.5. Using External Data Sources.......................................................................................2-890
23.5.1. The Execution Location of External Data Source Queries...............................2-890
Contents 1-15
6.5. Specifics of System Object Behavior with Enabled Data Separation Mode...............2-1229
6.5.1. Changing Separator Values..............................................................................2-1229
6.5.2. Object Numeration............................................................................................2-1230
6.5.3. Real-Time Timestamp......................................................................................2-1230
6.5.4. Predefined Data.................................................................................................2-1230
6.5.5. Access Rights....................................................................................................2-1231
6.5.6. Users.................................................................................................................2-1231
6.5.7. Exchange Plans.................................................................................................2-1232
6.5.8. Functional Options............................................................................................2-1233
6.5.9. Scheduled Jobs..................................................................................................2-1233
6.5.10. Background Jobs.............................................................................................2-1234
6.5.11. Web Services..................................................................................................2-1235
6.5.12. Constants.........................................................................................................2-1235
6.5.13. Registers.........................................................................................................2-1235
6.5.14. Document Sequence.......................................................................................2-1238
6.5.15. Infobase Options.............................................................................................2-1239
6.5.16. Session List.....................................................................................................2-1239
6.5.17. Connection List...............................................................................................2-1239
6.5.18. The Event Log................................................................................................2-1239
6.5.19. Settings and Favorites.....................................................................................2-1243
6.5.20. History............................................................................................................2-1243
6.5.21. Queries............................................................................................................2-1244
6.5.22. Managed Transaction Locks...........................................................................2-1244
6.5.23. Exclusive mode...............................................................................................2-1244
6.5.24. Deleting Marked Objects................................................................................2-1245
6.5.25. Full-text search...............................................................................................2-1245
6.6. Running the Client Application in Linux...................................................................2-1246
6.7. Specifics of Mobile Application Operations...............................................................2-1247
Appendix 7. Operation of Various DBMS............................................................................2-1249
7.1. General Features..........................................................................................................2-1249
7.2. File Database...............................................................................................................2-1249
7.3. IBM DB2 Server.........................................................................................................2-1250
7.4. Microsoft SQL Server.................................................................................................2-1251
7.5. Oracle Database Server...............................................................................................2-1252
7.6. PostgreSQL Server......................................................................................................2-1253
Appendix 8. Work in XBase..................................................................................................2-1255
8.1. Fields and Records......................................................................................................2-1255
8.2. Spreadsheet, Spreadsheet Structure and Database File...............................................2-1255
8.3. Indices, Index and Filter Expressions and Index File.................................................2-1256
8.4. Writing Changes to Database......................................................................................2-1256
8.5. Work with Index Files.................................................................................................2-1256
8.6. Record Deletion...........................................................................................................2-1256
8.7. Creation of Database, Index and Index File................................................................2-1257
8.8. Limitations..................................................................................................................2-1257
Appendix 9. Specifics of Using Separate Mechanisms........................................................2-1259
Appendix 10. Automatic Form Element Name Generation Rules.....................................2-1261
INTRODUCTION
This book is the guide for application development in 1C:Enterprise.
This document can be used by specialists developing, modifying and implementing
applications based on the 1C:Enterprise platform.
1C:DEVELOPER NETWORK
1C:Developer Network at http://www.1c-dn.com helps developers to create business
solutions based on the 1C:Enterprise platform.
The 1C:Developer Network knowledge base at http://1c-dn.com/library/ has informa-
tion for both novice and experienced developers, and provides you with everything
needed to create a complete business solution from scratch.
Introduction 1-25
AGREED NOTATION
To help you understand the material, this guide uses some general techniques to set
off certain text elements. You will find the agreement on these techniques below.
Keys: Keys such as Enter, Esc, Del and the like will be shown with the lettering on
the keys themselves, without quotation marks.
When referring to cursor control keys (arrow keys), we will use the phrase cursor
control keys when we need to refer to all these keys at once. If we need to refer to
these keys individually, we will use the expressions Up Arrow, Down Arrow, Right
Arrow and Left Arrow.
Keyboard Shortcuts: When you need to press a combination of two keys to
execute a command, it will be presented as Ctrl + F3.
Buttons: The names of the buttons in a form will be presented by their names
without quotation marks, for example, OK, Cancel, Delete and so forth.
1C:Enterprise Script Keywords: Keywords of the 1C:Enterprise script will be
highlighted by a font and written as in program modules: WorkingDate. The text
might also contain references to descriptions of sections or items in the 1C:Enter-
prise script (properties, methods, etc.). To view these descriptions, use Help content
(1C:Enterprise script branch).
Menu Actions: To describe selection of a menu item, we will use the following
sequence: Menu – Submenu – Submenu – … – Item. For example, "To choose the
scale, use Table – View – Scale." It is the same as the following: "To select the
image scale, use Scale on the View submenu of the Table menu in the program's
main menu." If the selection is not to be made in the main menu, this is specifi-
cally described.
1C:Enterprise Operation Modes: The 1C:Enterprise system has two modes of
operation: configuration setup and verification mode (hereinafter "Designer mode"
or "Designer" to refer to configuration creation or modification) and configuration
running mode (hereinafter "1C:Enterprise mode").
For the purposes of this guide, a user means a specialist who develops or supports
a configuration.
The %APPDATA% expression refers to a Windows environment variable which
contains a path to a directory (in the user profile) for the applications used for
storing data. If the default installation is used (for the user name Ivanov), the path
will appear as follows:
C:\Documents and Settings\Ivanov\Application Data
For Windows Vista and later versions the path will appear as follows:
C:\Users\Ivanov\AppData\Roaming
1-26 1C:Enterprise 8.3. Developer Guide
1.1. CONFIGURABILITY
A major feature of the 1C:Enterprise system is its configurability.
The 1C:Enterprise system itself is a set of mechanisms designed to manipulate
various types of objects in a subject area. A set of objects, data array structures and
information processing algorithms for the assigned task are defined by a specific
configuration. Joined with the configuration, the 1C:Enterprise system functions as
a ready-to-use software product customized for particular enterprise types and task
classes.
The configuration is created and supported by standard system tools. A configura-
tion is usually supplied as standard for a particular area of application, but it may
be modified or extended by the user or developed from scratch. The 1C:Enterprise
system supports standard configurations using standard tools.
for the catalog list form is automatically removed from the command interface.
When displaying forms, granted rights are also important.
Of all the properties inherent in a configuration object, some are available for
editing and can be modified during system configuration. Types of possible
changes and their limits are set at the system level. The specialist configuring
the system can intentionally modify properties of a configuration object to make
it behave as desired when the system runs. However, these changes do not alter the
essence of the object and will not enable it to perform actions that are not inherent
in objects of this type.
Consider the following example.
The Constant configuration object in the 1C:Enterprise system is designed to
store information that does not change over time or changes very rarely. Previous
values of a constant are irrelevant. A simple example of a constant would be the
name of the enterprise: it generally does not change as the enterprise operates
(if you expect to select values of time-variable accounting data depending on the
timing, you should use an information register without dimensions rather than
a constant).
A constant has a large number of editable properties. The following are the most
relevant:
constant name
synonym (alias)
comment
data type
data lock control mode
link opening the constant manager module
In the most general case, the value of a constant is entered once (for example, the
enterprise name). From the standpoint of constant use, it is not important what
exactly is stored in the constant; what matters is that the constant should preserve
the entered value.
The ability to preserve the entered value is an integral feature of constants in the
1C:Enterprise system. Editing constant properties does not affect this ability.
For example, a specialist who configures the 1C:Enterprise system aims to develop
a required set of catalogs, documents, reports and journals that implement the
desired accounting system. The end user of the 1C:Enterprise system – an execu-
tive, accountant, manager, storage clerk, etc. – also works with particular catalogs,
documents and so forth to accomplish his/her tasks. These two categories of users
also communicate in terms of configuration object types.
A data object of some type is a specific document, report, journal, constant, etc.
Each object is generally used to work with specific information of a subject area.
Below we outline basic types of configuration objects in the 1C:Enterprise system.
Detailed information on the configuration objects that make up each of these types
is provided later in this guide.
Constants
The system uses Constant type objects for constant and nearly constant data.
Information stored in constants rarely changes, but is often used, as a rule. For
example, constants can store the name of the enterprise, its tax ID, names of the
director and chief accountant and similar information.
The system supports an unlimited number of constants.
Catalogs
The system uses Catalog type objects for constant and nearly constant data
consisting of value sets.
Catalogs are usually lists of materials, products, entities, currencies, employees, etc.
Chapter 1. Concept of the System 1-33
The catalog engine allows the user to design and support various catalogs. Prop-
erties of each catalog can be described at the configuration stage. Customizable
properties include, for example, code length and type, number of hierarchical
levels, code uniqueness support and catalog attribute set.
Aside from the code and description, the catalog engine allows the user to create
attribute sets for storing any additional data about catalog items (e.g., for a product
line it could be the purchase and sale prices and the manufacturer; for an employee
it could be his/her job title, education, residence, etc.) as well as tabular sections.
Tabular sections store variable arrays of similar-type data, such as description of
product components, list of employee family members, organization telephone
numbers, etc.
Each catalog has several form type options: item, folder, list, selection and folder
selection. You can create an unlimited number of forms of each type.
You can use subordinate catalogs to describe subordinate entities. In this case, each
item of the subordinate catalog "belongs" to a particular item of the parent catalog.
In a specific configuration, the required number of catalogs is created to store data
on objects used to automate the given subject area. For example, you might have
catalogs called Organizations, Goods, Employees, etc.
Enumerations
The 1C:Enterprise system uses enumerations to describe constant sets of values that
do not change as the configuration runs.
At the configuration stage, you can describe a virtually unlimited number of
enumerations. Unlike values in a catalog, enumeration values are specified at the
configuration stage and cannot be changed at run time.
Typical examples of enumerations are forms of payment (cash, check or barter),
client status (regular or one-time), etc.
One of the main features of an enumeration that makes it different from a catalog
is that a set of values within enumeration does not change as the end user works
with the system. For example, the configuration algorithm could be designed so
that each client has one of two statuses: either "regular" or "one-time". In this
case, the user can specify the client's status by selecting one of the values from the
enumeration. The user cannot add a new status.
Enumerations are different from catalogs in that you normally enter specific values
for catalogs as you work with the program, for example: product names, contrac-
tors, etc.
Documents
Documents are objects used to represent business process events pertaining to
the automated subject area. For example, a configuration designed to account for
trading transactions may contain documents such as bills, receipts, invoices, etc.
1-34 1C:Enterprise 8.3. Developer Guide
Documents are used to show payments from the account, cash register transactions,
warehouse register records and other similar events.
Configuration involves customizing an arbitrary number of document types.
Typical examples of document types are Purchase Order, Bill, Goods Receipt, Sales
Invoice, Warehouse Transfer, Cash Receipt, etc. Each document type represents
a certain event type. It determines the structure and properties of the document as
defined in the configuration.
Each document type can have an unlimited number of attributes and tabular
sections. Several tabular sections are required when one document must record
essentially different but related events, for example: to show receipt of goods at the
warehouse and record additional expenses incurred – payment for transportation,
truckers, etc.
Document data are entered via input forms which are on-screen equivalents of
hard-copy documents. If the document data are used in other forms, forms selec-
tion are created to include this information. List forms are created for editing the
list of documents of a given type. The number of forms is unlimited.
Each document can also have an unlimited number of print forms.
All documents are characterized by a number, date and time. At the document
setup step, other options such as document number length, number uniqueness rules
and others can be set.
Documents are central to the basic mechanisms implemented by the system. All
documents form a single chronological sequence. The latter represents the
sequence of actual events. Within a certain date, document sequence is defined
by the document creation time. The document creation time is a way of arranging
documents in a proper and unambiguous order within the same date rather than
a record of the actual (astronomic) time of document input. Data entered in a
document (in its attributes and tabular sections) usually contain information about
an event – for example, an invoice contains information about the originating ware-
house, the type and quantity of goods shipped and any additional expenses incurred.
A crucial action for a document is its posting. If a document is not "postable",
it means that the event it reflects does not affect the state of the accounting main-
tained in that particular configuration. If a document is posted, it changes some
of the accounting data. Posting permits the event recorded in the document to be
reflected in the mechanisms implemented by various registers.
For example, a company can use Quote documents. These documents indicate
customer’s intents to buy goods or services and they usually do not alter the
status of the goods or cash. Therefore, they do not require posting transactions to
accounting registers.
In some cases a Quote can be used for reserving goods for a specific customer.
This locks a certain quantity of goods and removes them from the warehouse
balance. Therefore, this document will require posting the transaction to accounting
registers.
Chapter 1. Concept of the System 1-35
Document Journals
Document journals are designed for viewing various types of documents. Each
document type can be shown in several journals. A document journal does not add
new data to the system; it is a means of displaying documents of several types
in a single list.
For example, you can create a Warehouse Documents journal which will show all
receipts and invoices as well as internal waybills.
You can define columns for a journal to show attributes of the various document
types assigned to the journal. For example, a trading document journal can include
a Counterparty column that contains the Vendor attribute of a Purchase Order
document, the Customer attribute of a Sales Invoice document, etc.
Each journal can have an unlimited number of display and print forms.
Charts of Accounts
A chart of accounts is one of the basic accounting concepts. A chart of accounts
is a set of synthetic accounts that group information about enterprise transactions.
Data stored in synthetic accounts enable the user to get a complete picture of the
state of enterprise funds in monetary terms.
1-36 1C:Enterprise 8.3. Developer Guide
Exchange Plans
This object type is used to arrange data exchange between different infobases or
between infobases and external software systems.
Registers
Registers are designed for storing and processing various information that reflects
the enterprise commercial and organizational operations and has no objective
nature.
Registers usually store information on changes in the status of objects or other
information that does not directly reflect subject-area objects. For example, regis-
ters can hold information on currency exchange rates or information on the receipt
and dispensing of merchandise.
The 1C:Enterprise system has four types of registers:
information registers
accumulation registers
calculation registers
accounting registers
Configuration objects such as Catalog, Document and Data Processor are not
typed because they contain "complex" information and typed configuration objects.
Possible configuration object data types can be divided into two groups.
The first group comprises primitive data types: Number, String, Date and
Boolean. Accordingly, information stored in a configuration object can be
a number, an arbitrary character string, a date or a logical value. Additionally
primitive types include NULL, Undefined and Type (for details see section "Primi-
tive Data Types" in the 1C:Enterprise script help).
Some configuration objects in the 1C:Enterprise system can also specify data
types. For example, a constant can be assigned the DocumentRef data type.
In this case, the constant value represents a reference to a document existing
in the 1C:Enterprise system.
Configuration objects that can specify types of configuration values in the
1C:Enterprise system are called type-specifying configuration objects. These are:
catalogs
documents
charts of characteristic types
charts of accounts
charts of calculation types
exchange plans
business processes
tasks
enumerations
Please note that type-specifying configuration objects specify the data type
as soon as the Designer creates any of these types of objects. Three new
types appear immediately: Ref, Object and List. For example, when the
Designer creates a new catalog, new data types appear in its list of data
types: CatalogRef.<CatalogName>, CatalogObject.<CatalogName> and
CatalogList.<CatalogName>. These data types can be assigned to any typed
configuration object.
Some data can be assigned composite data types. To do this, select the Composite
data type check box in the data type editing window and specify the types that data
can have. You can also select a special type, AnyRef.
In addition to selecting attribute data types defined in a particular application, you
can select sets of types. AnyRef, CatalogRef and Characteristic.<name> are
examples of type sets.
Type sets, like the composite data type, contain a certain list of types defined
in the application, but, unlike the composite type, the system generates this list
automatically based on metadata analysis.
Chapter 1. Concept of the System 1-39
1.3.4. Form
Form is a combination of a dialog box, module, attributes and commands.
Most configuration objects in the 1C:Enterprise system can have a visual form.
In the most general case, a form as a configuration object comprises the following
components:
on-screen dialog box used to enter and edit information;
form module, i.e. program in the 1C:Enterprise script. The form module
generally processes information entered in the dialog box for input control,
calculations, etc.;
list of attributes;
commands used in the form.
Any of the form components can be blank, in other words, contain no information.
Forms can be used to implement user interaction with an application object.
The corresponding behavior is defined by the specialist who configures the
1C:Enterprise system. For details on form structure see page 1-361.
To develop forms, the Designer has a form editor which enables you to edit all
form components interactively.
1.3.5. Module
Module is a program in the 1C:Enterprise script. Modules are located at speci-
fied points in the configuration structure and executed at predefined times in the
course of 1C:Enterprise operation. The specialist who configures the system can
use modules to describe complex algorithms of interaction between configuration
objects that do not have adequate visual tools available in the Designer.
A configuration has several types of modules. These are: managed applica-
tion module, ordinary application module, external connection module, session
module, common modules, form modules and configuration object modules (value
managers for constants, catalogs, documents, charts of characteristic types, charts
of accounts, charts charts of calculation types, exchange plans, business processes,
tasks, reports, data processors and sets of register records), configuration object
manager modules (for catalogs, documents, charts charts of characteristic types,
charts charts of accounts, charts charts of calculation types, exchange plans, busi-
ness processes, tasks, reports, data processors, information registers, accumulation
registers, accounting registers, calculation registers, enumerations, document jour-
nals and settings storages), record set modules (information registers, accumulation
registers, accounting registers, calculation registers), command modules.
To access a module, select Open Object Module… in the configuration object
context menu. Select managed application module, session module, external
connection module and ordinary application module for the root configuration
object. Some objects (for example, constants or document journals) have no
modules.
Chapter 1. Concept of the System 1-41
For a detailed description of modules see section "What is a Program Module?"
in the 1C:Enterprise script help.
Within object modules you can declare variables, procedures and functions that
extend the object context and are available for working with the object externally
using the 1C:Enterprise script. These modules contain procedures for processing
various events, for example, Generate. They also have various procedures to
perform actions with an object that are initiated from outside the object (for
example, printing).
Manager module allows you to extend the system-provided manager functionality
by creating procedures and functions using the 1C:Enterprise script. In fact, this
enables you to define methods for a configuration object (e.g., a catalog) that refer
to the configuration object in general rather than to a specific database object
instance. The manager module cannot have variables or a module body.
If the manager module procedures and functions are declared as exported, they are
accessible through the object module.
1.3.6. Template
In the 1C:Enterprise system a template is a configuration object designed to
generate print forms.
Common print form templates are located in the Common templates branch of
the configuration tree Common branch, while print forms of configuration objects
(catalogs, documents, document journals, charts of accounts, charts of character-
istic types, charts of calculation types, registers, reports, data processors and other
objects) are located in Templates subordinate objects and in external files (in the
latter case, you have to set the Template property for the spreadsheet).
Templates can be of the following types:
Spreadsheet document: Standard methods to create and use templates are
expected. The template is prepared using the spreadsheet editor.
Text document: Use of a text document as a template is expected. The text
template is prepared using the text template editor.
Binary data: Binary data are used.
Active document: Use of OLE Active document method is expected.
HTML document: Use of HTML editor is expected.
1-42 1C:Enterprise 8.3. Developer Guide
Using the 1C:Enterprise server cluster is a good way of centralizing the most
resource-intensive operations of data processing. For example, user applica-
tion can only retrieve the required data selection, while the server performs all
the processing, even with the most complex queries. Expanding a server cluster
is generally a lot easier than upgrading all client machines.
Another important aspect of the three-tier architecture is ease of administration and
streamlined access of users to the infobase. In this mode the user is not supposed
to know the physical location of the configuration or the database. Access is always
granted through the 1C:Enterprise server cluster. When sending a request to
a database, the user is only required to specify the cluster and infobase names,
while the system prompts the user to enter username and password. For details on
system administration see "1C:Enterprise 8.3. Administrator Guide".
Although the 1C:Enterprise system tries to hide database server behavior from
the user, it is not always possible. For information about system interaction with
a specific database server see page 2-1250.
An important feature of the client/server mode is the ability to run
the 1C:Enterprise server and database servers under various operating systems
(the Windows family and various Linux distribution kits).
Wizards are auxiliary tools that simplify development of standard items in the
1C:Enterprise system. For example, the system has wizards for constant forms,
catalogs, documents, document journals, reports and other objects; print form
wizards; register record wizards and more.
You can use wizards to generate visual components of these objects and, in certain
cases (generating objects based on other objects, printing, output form, etc.), to
generate program modules.
User Interface Customization System. For the interface of a particular system
configuration to fully include customized data structures and algorithms, the
1C:Enterprise system, in addition to the dialog box form and spreadsheet editor,
provides a functionality of system command interface setup.
The command interface is set up automatically based on the access rights of a user
logging into the system. Consequently, the user will only see accessible system
objects.
Subsystems. The Designer enables you to select various subsystems within
a single configuration (for example, trade accounting and research system) at
the design stage. You can specify configuration objects to be included in each
subsystem. A single object can be assigned to multiple subsystems. In essence,
subsystems define main configuration sections available to the user. Since the
subsystem structure defines the configuration interface, you should pay special
attention to subsystem design (and hierarchy).
Access Rights (Roles) Customization System. This system permits description of
sets of rights corresponding to user job titles or types of activities. The structure
of rights is determined by the specific system configuration. For example, you can
create sets of rights such as Chief Accountant, Storekeeper, Manager and Head of
Department.
In addition, for objects stored in the database (catalogs, documents, registers, etc.),
you can define access rights to specific fields and records.
The actual user list is created for your specific organization. Each user is assigned
one or more roles, default interface and language to be used when he or she works
with the program.
Debugger. The system provides a debugger for convenient configuration develop-
ment. The debugger permits the user to follow execution of configuration program
modules, measure the relative execution time and inspect the contents of variables.
Configuration Repository. In distributed configuration development, developers
use a configuration repository mechanism. It enables you to assign access rights to
modify a configuration object and make the necessary changes concurrently rather
than sequentially.
Configuration Support. To make configuration updates easier, the system
provides a mechanism for developers to generate standard configurations of
distribution files and distribution kits (including installation program) as well as
a mechanism for updating standard configurations under support contracts.
1-46 1C:Enterprise 8.3. Developer Guide
Chapter 2
This chapter describes general techniques for working with configuration objects
which are applicable to objects of all types. We will discuss specifics of creating
and editing various types of configuration objects later, in the corresponding chap-
ters of the guide.
This chapter mainly covers visual tools for configuration object management in the
Designer. For a description of the 1C:Enterprise script see the 1C:Enterprise script
help.
For information about saving and restoring infobases see "1C:Enterprise 8.3.
Administrator Guide" or "1C:Enterprise 8.3. Client/Server. Administrator Guide".
The 1C:Enterprise infobase stores two configurations:
basic configuration (editable and referred to as "configuration")
database configuration
The database configuration determines the structure of database tables and the full
set of functions accessed by users. The master configuration is only used to make
changes. When operated by users, it allows changes to be entered and saved in the
configuration. The database configuration cannot be changed when operated by
users. For information on working with the database configuration see page 1-63.
You can search the metadata tree using one of two methods:
Start entering the object name (it searches the object in open tree branches only).
Use standard search functionality (press Ctrl + F to open the search window).
This opens the Search results window where you can navigate to the required
metadata object.
You can use the mouse to drag names of configuration objects and subordinate
objects (attributes, tabular sections, forms, etc.) into modules and text documents.
To navigate to the object referencing the object you wish to delete, double-click its
name in the message window.
You need to specify the search area (properties, subordinate objects) and click OK.
If references exist, they will be listed in the message window when you execute the
command. If there are no references, one of the following warnings is displayed:
There are no references to this object.
Reference not found in object.
Use Actions – Find References in Object to display a list of all aggregate types
used in the object.
To follow a link, double-click the corresponding line containing the name of the
referenced object in the message window.
The properties palette toolbar has five buttons (see fig. 6). The first three buttons
manage how properties are displayed.
To sort by category, select the Sort by categories button on the toolbar. All prop-
erties are grouped in categories and displayed as a list (one below another).
Category names are displayed in bold. You can control display of properties
within the category by using a button to the left of the category name. This button
hides or displays a set of properties.
Double-clicking the name of a property category collapses all other categories and
shows properties of the selected category.
If you select the Show only important elements button, only important (main) prop-
erties of the object are displayed (regardless of whether the display is set to list or
tabs, categories or alphabetical order). To view all properties, press the Show only
important elements button again.
Object properties are available or unavailable for editing depending on its type. For
example, in a text document, object properties are designed only to show the number
of lines and characters and the document status, but they are not available for editing.
Each property in the properties palette has a name and detailed explanation.
The detailed description can be viewed using the Comment command of the
context menu which can be displayed by clicking anywhere in the properties
palette (outside text boxes). If this mode is set and you select a property, detailed
explanation appears in the lower part of the properties palette. In addition to the
explanation, the name of the property may be displayed for access to the value from
the program module.
Properties accessible via the 1C:Enterprise script can be displayed either as descrip-
tions or as property names, e.g. a property with the Value type description has the
ValueType name. Display mode can be changed using the Display property names
command in the context menu. Property names are displayed according to the
selected option of the 1C:Enterprise script.
IMPORTANT!
Names of properties for metadata objects and the Configuration metadata object
are not displayed.
The way you enter values in the properties palette depends on the type of property
you are editing.
You can enter text for text attributes in the usual way (using the clipboard) or select
check boxes by clicking. For some properties, values are selected from lists. Fields
of such properties have a selection list button (see fig. 7). If a property field has
a selection button (see fig. 7), clicking it opens a window where you can select
a value for the property (or view it if editing is not permitted, for example, for
objects that are not locked in the configuration repository or for objects that are
supported without possibility of change). Such properties include, for example,
picture file selection, color definition and others.
The view button (see fig. 7) has various functions: for text data, it opens the
window for editing strings in various languages; for events, it calls the form
module procedure that handles a particular event; for properties from the Presen-
tation category, it calls the existing data object form. The clear button (see fig. 7)
clears the value of the specified property. The spin button (see fig. 7) increases or
decreases a numeric value by 1.
Fields can also have combinations of buttons.
When you begin editing any text field in the properties palette, the properties
palette toolbar buttons Cancel Editing (see fig. 6) and Save (see fig. 6) become
available. Clicking the Cancel Editing button discards any changes you have made.
Clicking the Save button saves the changes.
The properties palette may contain links that open various forms associated with
the selected object. These may include, for example, displaying help content
(description) for a configuration object, various forms or form module procedures.
These links are underlined. Clicking the link opens the associated window.
If you view properties of an object that you cannot edit (for example, if the object
is not locked in the configuration repository (see page 2-1088), you can open the
type editing dialog box as read only.
The Data Access Restrictions table box allows you to edit data access restrictions at
the level of individual fields and records (for details see page 1-188).
The Functional options tab lists functional options existing in the system. You can
select the functional options bound to a particular metadata object.
The Common attributes tab can be used to specify to which common attributes the
current object belongs. The editing rules in this window are similar to those in the
Content window of a general attribute property.
The Exchange plans tab shows a list of exchange plans. The exchange plans
where changes for a particular object are recorded are marked in the list.
The Command interface tab can be used to edit visibility of standard and custom
commands for the selected metadata object in various subsystems. Commands
included in the desktop are grouped in the Desktop node.
The Enter based on tab shows a list of objects used as a basis to create a particular
object and a list of objects serving as a basis for exchange plans.
Chapter 2. Work with Configuration 1-59
The Only selected check box can be used to display selected objects only or all
objects that can be input on a certain basis with selected objects marked by check
boxes.
The Delivery settings tab can be used to select a distribution rule for the configu-
ration object selected, similar to the special distribution configuration dialog (see
page 2-1122).
Available tabs and a set of controls on similar tabs can vary depending on the type
of configuration object.
For example, for a Catalog object, the editing window looks like the following:
The Main tab allows you to specify Name, Synonym and Comment properties.
Additionally this tab is used to set properties that create an object presentation
in the command interface (for details see page 1-250).
On the Subsystems tab, you can specify which subsystems use the object. You are
allowed to include the object into subsystems regardless of their mutual subordina-
tion. The object can belong to both a parent subsystem and its subordinates. Object
membership in subsystems defines where in the command interface commands for
the edited object are displayed. For details on the command interface see page 1-83.
The Data tab can be used to create attributes, resources, dimensions, tabular sections
and tabular section attributes as well as other subordinate objects (depending on the
object type). This tab can also contain other controls for setting up properties that
are characteristic of particular object types.
Thus, for a catalog, its description and code length, code type and default presenta-
tion of catalog items is defined (see fig. 17).
Use buttons on the toolbar located above the lists of subordinate objects to add,
delete and sort these objects. Specify properties of subordinate objects in the prop-
erties palette.
If you open the editing window for an object that you cannot edit (for example,
if the object is not locked in the configuration repository (see page 2-1088)), you
can open the type editing dialog box as read-only.
Chapter 2. Work with Configuration 1-61
The Forms tab is used to manage object forms and to select default forms.
The Quick choice property controls the default selection mode. For details on how
this property works see page 1-274.
The Commands tab can be used to set custom commands associated with the
object. For a description of command types see page 1-338.
Adding a new form launches the form wizard that can be used to select a form type,
attributes placed in the form and the form structure. For details on how the form
wizard works see page 2-987. For the main form editing methods see page 2-937.
The Templates tab is used to handle object templates.
Adding a new template launches the template wizard that helps create templates.
For details on how the template wizard works see page 2-990.
Below the list of templates is the Wizards button. Clicking it opens a submenu
where you can select the type of wizard (wizard availability depends on the object
type).
Selecting Print Design Wizard launches the print wizard that is used to create
a print template and routine. For details on how the print wizard works see
page 2-982.
Selecting Output Form Wizard launches the output (report) form wizard.
On the Rights tab, define rights relative to a particular object for each role.
For application objects (catalogs, documents, charts of characteristic types, charts
charts of accounts, charts charts of calculation types, registers, business processes
and tasks), the Data exchange tab specifies a list of ExchangePlan objects. Mark
the exchange plans that will record changes to the object you are editing.
The Other tab contains buttons that open an object module, manager module or
help content and can also contain the Predefined button that opens a list of prede-
fined object items (for catalogs, charts of characteristic types, charts of accounts
and charts of calculation types). The tab can also contain lock control attributes
(see page 1-516) and full text search settings (see page 2-835). These attributes are
only displayed for the following application objects:
catalogs
documents
charts of characteristic types
charts of accounts
charts of calculation types
registers
business processes
tasks
Some objects may contain special tabs associated with this object type only.
Catalog type objects may have Hierarchy, Owners and Numbering tabs;
Document objects may have Numbering, Posting, Journals and Sequences tabs;
Chapter 2. Work with Configuration 1-63
debugging and update the database configuration. Select No to discard the update
and continue debugging.
To update the database configuration, the Designer requires exclusive access to
the infobase. Depending on whether there are users working with the database and
what mode they use, the system may behave in different ways:
The Designer displays an exclusive lock error message in the following cases:
○○ The file mode of the database is in use.
○○ Some sessions are connected to the infobase without using the Web Server.
○○ No sessions are connected through the Web Server.
○○ Updating the configuration requires database restructuring.
The Designer prompts to terminate all sessions and re-try updating in the
following cases:
○○ Updating the configuration requires database restructuring.
○○ The file mode version of the infobase is used by web clients and thin clients
connected via the Web Server.
In all other cases the Designer prompts the user to perform a dynamic update.
NOTE 1
Troubleshooting messages contain characteristics of the sessions preventing the
system from performing the requested action. If the number of these sessions does
not exceed 5, a detailed list of sessions is displayed (with the machine name,
application type, etc.); otherwise the total number of sessions is only displayed.
NOTE 2
Infobase operation in the exclusive mode does not switch the Microsoft SQL
Server database to the single user mode.
NOTE 3
To speed up infobase restructuring, it is recommended to set the database recov-
ery mode to the Simple or Bulk logged values when Microsoft SQL Server DBMS
is used. The mode can be changed either before the restructuring operation or on
an ongoing basis if it is not necessary to restore the database at an arbitrary point
of time. Before changing the database recovery mode, back up the database.
If Close sessions and repeat is selected, the user is prompted to confirm the
selection action (Closing sessions will result in abnormal termination of all infobase
users’ work! Do you want to close sessions?). If the action is confirmed, the system
attempts to terminate all infobase sessions. Then the system retries to save the data-
base configuration.
Terminating all sessions shuts down all client applications.
In some situations sessions cannot be terminated. In this case you can either retry
to update the database configuration later or terminate sessions by other methods
(e.g., by reloading the working processes).
Dynamic Update
If dynamic update is allowed, the user will see a corresponding message (see
fig. 22).
Select the Dynamic update command to perform an update without interrupting user
operations. In this case changes you make are saved dynamically as a version of
configuration changes (the database configuration remains unchanged). Repeated
changes to the master configuration are allowed. If during the next database
Chapter 2. Work with Configuration 1-67
configuration update you can enable the exclusive mode, the Designer will perform
the database configuration update and include all the changes (both current and
previous).
NOTE
If the client/server mode of the infobase is used, then the Designer is restarted
after the update. All unsaved changes in text, spreadsheet and other documents
will be lost.
In case of dynamic update active users continue to work with the previous
configuration. To access the updated configuration, the user should restart the
1C:Enterprise system. For the purposes of control and user notification about
dynamic changes, use the DataBaseConfigurationChangedDynamically()
global context method.
NOTE
After the database configuration is updated all other versions created by dynamic
updates are removed.
If changes requiring database restructuring are found, a dialog box with a list of
these changes is displayed so that you can confirm that the update should go ahead.
□□ Charts of accounts
□□ Business processes
□□ Tasks
○○ In the processing phase, the system records all data changes for the above
objects by analogy with a data exchange mechanism.
Refreshing phase:
○○ This starts automatically with a 1-minute interval after the processing phase
finishes.
○○ Users can work with the infobase during this phase.
○○ The phase comprises automatically repeated iterations. Each iteration
analyzes the changes accumulated since the previous iteration (or since the
processing phase finished) and performs restructuring of the data.
○○ Iterations are completed at the moment the next phase starts.
Change acceptance phase:
○○ This phase requires exclusive access to the infobase.
○○ Users cannot use the infobase in this phase.
○○ The first step here is refreshing any data accumulated since the most recent
iteration of the refreshing phase.
○○ Then the system performs restructuring of data that were not involved
in processing and refreshing operations during the respective phases.
Changes to this data are not significant, thus their restructuring does not take
very long.
○○ The next step is acceptance of all changes made in the database.
○○ The database configuration update process is then complete.
If the background update is run in such a way that it does not require database
restructuring, the entire update process is executed at the change acceptance phase,
which begins just after the background update is launched.
During the background update, the server operation can be stopped or the back-
ground update process can be paused.
After the server is stopped or the working process supporting the system’s back-
ground update job is aborted, the creation of the first session will require a bit
more time than usual. This occurs due to background update recovery. However,
the background update process itself is suspended. To proceed, you need to restart
the background update execution. This behavior is implemented to prevent the
system looping in the event that the abnormal end of the working process that
supports the background update was caused by this background update itself.
After the server operation is recovered, the background database configuration
update proceeds as follows:
If the operation has been terminated at the processing phase, the process
resumes from the most recent configuration object whose processing has not
been completed.
1-70 1C:Enterprise 8.3. Developer Guide
If the operation has been terminated at the refreshing phase, any iteration that
has not been completed will resume.
TIP
We recommend canceling any background database configuration update process
already started if you do not plan to complete the background database configu-
ration update (e.g. if the process is put on an "infinite pause"). Following this
recommendation will be positive for the system characteristics as no change
registration will be performed to execute the refreshing phase.
When executing background restructuring, please note the following features of the
system’s operation:
If the accumulation register or accounting register is part of a separator, then
the register is processed during the change acceptance phase.
If the type of an independent separator has been changed (see page 2-895), all
the objects included in this separator are processed during the change accept-
ance phase.
If the dimension type included in the main filter of an independent information
register is changed, the register will be processed during the change acceptance
phase.
Clicking the Run button will launch the Processing Phase. When you do this, the
service message window will display the following:
After the background update has been started, the configuration becomes locked
against changes. The background update operation can be paused at any phase by
clicking the Pause button. Click the Continue button to go on with the background
update process.
The processing phase is followed by the refreshing phase, during which you can
move the system to the change acceptance phase by clicking Finish or choose not to
update by clicking the Cancel button.
TIP
We recommend canceling the background database configuration update process
already started if you do not plan to complete the background database configu-
ration update (e.g. if the process is put on an "infinite pause"). Following this
recommendation will be positive for the system characteristics as no change
registration will be performed to execute the refreshing phase.
The Allow dynamic update check box is used to define whether the system
should try to execute a dynamic update instead of starting the background data-
base configuration update process after the Run button is clicked. If this option
is checked, then once the Run button is clicked, the system will verify whether the
dynamic configuration update can be performed. If the configuration allows this,
the background database configuration update will be replaced with a dynamic
update.
The Update on the server check box is used to define where the process will be
launched, completed or canceled. The above commands will be executed in the
client application if this option is unchecked, or on the 1C:Enterprise server side
if checked. In addition, if the option is checked, the configuration can be updated
even if you have only the DataBaseConfigurationUpdate right, setting the
Administration right is not obligatory.
Objects other than development objects are saved to parent object files, e.g. the
DataProcessor.PrintLabelsAndTags.Template.BarcodePrintingComponentLinux32.
Template.bin file means the external component of label and tag printing that
is located in the BarcodePrintingComponentLinux32 binary template.
The following items are dumped in a particular way:
Object module – it is dumped as a text file (if any) or in the binary form.
File name example:
○○ DataProcessor.EventLog.ObjectModule.txt – the Processing.EventLog
metadata object module.
HTML – it is dumped as a set of files: a property root file, HTML page files,
picture files (if any). The root file contains a list of HTML pages included
in the document. HTML files are pages included in the document. Each of
these corresponds to a specific language defined in the configuration. Configu-
ration Object Help represents a particular instance of HTML dump.
File name examples (for the Help property):
○○ Catalog.Goods.Help.xml – a root file of the external help property of the
Catalog.Goods metadata object.
○○ Catalog.Goods.Help.ru.html, Catalog.Goods.Help.en.html – help pages for
the Russian and English versions respectively.
○○ Catalog.Goods.Help.Picture.png – a picture file in the HTML document
with help.
Vendors' configurations – these are damped as a file with the information on
vendors' configurations in an external format (other than XML) and configura-
tion files (.cf) for each vendor's configuration.
File name examples:
○○ Configuration.ParentConfigurations – a file with the information on vendors'
configurations.
○○ Configuration.ParentConfigurations.TradeManagement.cf – the vendor's
configuration TradeManagement.
All references to metadata objects as well as references to fields, type identi-
fiers, etc. are dumped as names (Catalog.Goods). All identifiers are dumped
in English – a reference to the Goods catalog will appear as Catalog.Goods.
Should configuration objects contain references to absent configuration objects,
such references are dumped as identifier text views and are restored in a reference
to the absent configuration object at loading (to keep these two configurations iden-
tical). Internal identifiers are dumped for attributes and managed form elements.
These identifiers are used to save and restore settings, among other things.
When roles are dumped, the system dumps only the values of those rights that are
different from the default values at the moment of dumping. When default rights
values are defined, the following role properties are used: Set rights for new objects
1-76 1C:Enterprise 8.3. Developer Guide
and Set rights for attributes and tabular sections by default. The values of these
options are default options for access rights to configuration objects and access
rights to attributes and tabular sections, respectively.
NOTE
Ordinary forms and interfaces of ordinary applications are dumped in binary
form.
If any errors are identified in files when they are being restored, the system will
generate a window containing the list of errors. Where errors are not critical, you
can click Accept. Selecting a line with an error will open the file with the error.
In the Find what field of the dialog box, enter a search string or select one of the
strings used in previous search operations.
In the Replace field, enter replacement text or select one of the strings used
in previous replace operations.
To make the search case-sensitive, select the Match case check box. If you select
Find whole words only, the system only finds whole words rather than their parts.
If you do not want to open editors in a global replace operation (using the Replace
all button), select Silent global replace (do not open editors). The editor will open
regardless of this check box setting if you click Find or Replace.
Below is a panel with tabs where you can specify objects where the string should
be searched.
On the Text types tab, you can mark types of subordinate objects to be searched.
If the configuration is editable for the Managed application run mode (see page
2-1148), user interfaces will be excluded from the object list.
On the Configurations tab, you can specify precisely, down to the object, configura-
tion sections to be searched.
In addition to the master configuration, the list of configurations also includes the
database configuration and the repository configuration. The repository configura-
tion must be open before you start the search or replace mode.
Chapter 2. Work with Configuration 1-79
To specify a set of objects, select the Selected objects toggle and check the objects
to be searched. The first time you run the search, all objects in the list are checked
by default. To clear the setting, uncheck the box for the line with the configuration
name. Then you can specify particular objects to be searched.
On the Files tab, you can specify directory and file types to be searched. You
can view the following types of viewable files: configurations in files (saved
configurations and distribution files), external reports and data processors, text
and spreadsheet documents. If no directory is specified (the Directories attribute
is blank), the system does not search in files. You can also search open documents
of the same types. To do so, check Search in open documents.
You can save the selected group of settings for further use. To do so, specify the
setting name in the Search scope field. To use the previous setting, simply select
the setting name from a dropdown list. The following settings are saved: settings
on the Text types tab, the object structure for the main configuration on the Configu-
rations tab, and the settings from the Files tab. If the search mode has been started,
press the Find button to begin the search.
You can interrupt global search by pressing Ctrl + Break.
A list of matches found for the source text is displayed in the Search results
window.
If a module has restricted access (see page 2-956), the system requests an access
password before searching for the source text in that module. You must enter the
correct password or refuse to enter the password. If you do not enter the password,
this module is skipped.
You can view search results and go to each occurrence found by selecting the
desired line in the search results and pressing Enter. To view the next or previous
occurrence, you can use the following menu items: Actions – Next item and
Actions – Previous item.
You can copy search results (the entire list) to the clipboard using the Copy
command of the context menu or clicking the corresponding button on the toolbar
of the search results window; you can also export the results to a text or spread-
sheet document.
1-80 1C:Enterprise 8.3. Developer Guide
You can change the column width by using a standard method: dragging the
column border while holding down the Ctrl key.
If the replace mode has been started, use the Replace box to enter the text string
that will substitute the source text specified in the Find what box.
If you need to view the source text before replacement, click the Ignore button to
begin the search. The first found occurrence of the source text will appear on the
screen. If you click Ignore, the current text is skipped and the next occurrence of
the source text is displayed in the current window or another window containing
the source text.
If in case of global replace you do not need to open objects in which the source
text is found, check Silent global replace (do not open editors).
IMPORTANT!
While viewing search results, you cannot change search criteria.
The selected search area (types of text, list of configuration objects, files and open
documents) is saved and restored the next time you open the dialog box. If you
need to save several areas, you need to give each a name in the Search scope
attribute. When you reopen the search window, you just have to select the area you
need from the list and perform your search.
Every window in the Designer (except the Calculator) can be switched to Autohide
mode. This mode allows you to select the desired window for viewing and editing
simply by moving the cursor to the window title bar. When you are done viewing
it, you can minimize the window simply by moving the cursor to any other window
or to the title bar of an autohiding window. It's good to use this mode with windows
you need briefly (Syntax Assistant, the Configuration window, message and search
results window and windows of application objects, spreadsheet and text docu-
ments which you open mainly for viewing).
The Floating window state lets you place any window anywhere on the screen,
regardless of the size and position of the program (Designer) window.
In the Docked mode, a window can be docked to another window in this state,
to one of the sides of the Designer window or above another dockable window
(stacked windows).
We recommend combining windows that you do not need to view simultaneously.
For example, the properties palette window and the Syntax Assistant window or
Immediate window and Call Stack during debugging.
For details on window display modes see page 2-1143.
Chapter 3
APPLICATION INTERFACE
The application interface is oriented for a better user experience and designed in a
such way that users work with different forms when they perform necessary actions
in the application. You can open any form using different methods, as is described
later in this manual.
To get access to a form you need to find a corresponding command (open list,
generate report, enter document, etc.) in the application interface and run it.
The process of searching for a command is called application navigation.
The structure of the application solution in the managed application represents
a hierarchy formed by subsystems and their metadata objects (see page 1-173).
Forms with which users work
can be displayed using different
methods:
A start page
A separate window
A separate tab
A single-window mode, i.e.
the Taxi interface
The form opening mode (in
separate windows or tabs)
is defined by the client applica-
tion setting and is effective after
the client application has been
restarted.
This setting is configured in the client application option setting dialog available
via the Main Menu – Tools – Options command.
When the required display option is selected, the system prompts the user to restart
the application.
When the Restart button is pressed, the application is restarted and opened again
using the selected display option.
There are two types of windows in 1C:Enterprise:
main window
auxiliary window
Each window type in 1C:Enterprise is used to perform certain tasks. The main
application window is used to navigate through the application solution and run
various commands. The auxiliary window is used to work with the infobase
objects (such as documents or catalog items), build reports and run data proces-
sors. The auxiliary window role can be performed by a tab displayed in the main
window's work area.
The following rules also apply to displaying groups in the Actions Panel:
Commands of identical groups from the displayed section and all of its subsec-
tions are placed into a single list.
Commands are displayed in the same order as sections and subsections custom-
ized during configuration.
Commands within sections and subsections are displayed in the order set
during configuration.
The order of sections (top-level subsystems), subsections (subordinate subsys-
tems) and commands in the groups of the Actions Panel can be modified in the
command interface editor.
By default height of the Actions Panel is defined by the number of commands
in the groups and does not exceed three lines when set automatically. The user
can, however, customize the height using the separator below the panel. If
the Actions Panel of the current height cannot accommodate all commands of
a particular group, the bottom right corner of the group contains an icon that opens
a menu with all commands of the group.
The left-hand part of the system commands area contains a button that opens the
main menu and commands used to switch between navigation points and user
favorites menus. Navigation point is a fragment of the main application window
interface. You can navigate to the fragment by using commands in the main appli-
cation window.
In 1C:Enterprise, favorites are a list of links selected by the user for fast navigation
to the selected configuration sections, navigation points, infobase object forms or
report and data processor forms.
You can manage the favorites list programmatically. To do so, use the
UserWorkFavorites object. You can retrieve it from the system settings storage.
NOTE
When working with favorites, please remember that the favorites list has one level
only.
You cannot add a link to a standard function (opened by selecting Main Menu – All
functions – Standard) to the favorites list.
The system commands area in auxiliary windows has a different look (see page
1-90).
The right-hand part of the system commands area contains auxiliary commands
that facilitate use of windows. You can set up the list of commands using a special
settings menu.
NOTE
The Desktop tab is always shown first.
You can open any tab (except the Desktop tab) in an auxiliary window. To do this
you need to run the Open in new window command in the tab's context menu.
The tab header changes its size according to the number of tabs in the main menu.
When the number of tabs increases, the tab header size decreases and the header
may become unreadable. In this case you will need to use a special button to the
right of the tabs to get a list of the tabs opened (see fig. 37).
If a blocking form (such as the selection form) is opened in a form which was
opened in a tab, this form is not shown as a separate tab and is not included
in the window list in the taskbar. This form blocks only contents of the tab where
the blocking form was opened. You can still switch between tabs. If you switch to
a tab with an opened blocking form, it will be shown on the screen.
1-92 1C:Enterprise 8.3. Developer Guide
Commands are displayed in the same order as sections and subsections custom-
ized during configuration;
Commands within sections and subsections are displayed in the order set
during configuration.
The order of sections (top-level subsystems), subsections (subordinate subsystems)
and commands in the See also group of the navigation panel can be modified
in the editor of the command interface fragment.
The left part of the system commands area contains a button that opens the main
menu as well as commands for opening the function and user favorites menus.
The main menu contains the View menu, which can be used to configure the appli-
cation's window appearance.
In particular, this menu can be used to hide the Section Panel, Navigation Panel
and Actions Panel. It will increase the space for forms and decrease the likelihood
of scrollbars being displayed. Also note the Hide all command bars command.
The Sections Panel, Navigation Panel and Actions Panel are hidden after this
command is run.
If you run the command again, the hidden panels will be restored. You need to
remember the following: the Hide all command bars command will not work if the
Sections Panel, Navigation Panel and Actions Panel are hidden with the View menu.
To fasten and simplify access to commands of a subsystem, a special mode,
Function menu, is used. You need to click a special button located in the system
command area to enter this mode (see fig. 42).
The Function menu is a section panel with a special form containing all commands
for the selected section. A list of sections and commands corresponds to the current
user settings. The first form column corresponds to the navigation panel, other
columns correspond to actions panel groups of the selected subsystem. Display of
a sections panel does not depend on the state of the Main Menu – View – Sections
panel setting. Once you have selected the command you need, the window restores
its appearance to what it was before the function menu was opened. The list of
commands is updated if you select another section in the function window.
Chapter 3. Application Interface 1-97
In 1C:Enterprise, the Favorites are a list of links selected by the user for fast
navigation to the selected configuration sections, navigation points, infobase object
forms or report and data processor forms.
You can control the Favorites list programmatically. To do so, use the
UserWorkFavorites object. You can retrieve this from the system settings storage.
NOTE
When you work with the Favorites, please remember that the Favorites list has
one level only.
You cannot add a link to a standard function (opened by selecting Main Menu – All
functions – Standard) in the Favorites list.
The system commands area in the auxiliary windows has a different look (see
page 1-90).
The Window menu displays the main menu, window tabs and auxiliary windows.
The following items are checked:
the active auxiliary window
the active main window tab
the main menu itself, if no tab is opened in it.
The right side of the system commands area contains auxiliary commands which
facilitate the use of windows. You can set up the list of commands using a special
setup menu. Command availability and composition depend on the form currently
in the active tab.
1-98 1C:Enterprise 8.3. Developer Guide
The Taxi interface supports placing several different panels in the main applica-
tion window in any order (see page 1-106). The work area of the main application
window displays all the forms with which a user works. The only exception is the
blocking forms, which open in separate windows. If a blocking form (a selection
form, for instance) is opened in another form that has been opened in the work
area, then that blocking form is displayed as a separate window but is not shown
in a list of windows on the tasks panel. Depending on the mode for opening
windows (see page 1-396), either an owner form or the whole system interface
will be blocked. If an auxiliary window is opened in the blocked owner window
mode, you can still open other forms and use the command interface of the applica-
tion. When a user switches to the form that was used to open another form which
blocked the owner, the blocking form will be displayed on the screen.
We will now review the components of the main application window in greater
detail.
This is the page where the application developer places all the forms that he or she
believes are most useful in this application. The availability of the forms on this page
depends on access rights and functional options. The start page cannot be closed.
The interface of the start page is set up with the aid of the configuration properties
(see page 1-167). Users can also customize the contents of the start page from a list
of available forms that the application developer placed on the start page. To do
this, use a special start page setup dialog: Main Menu – View – Start page setup.
Fig. 46. The function menu is displayed when a section is selected
The panel is displayed. In that case, if a section is selected, the function menu
will not be opened, but the contents of the command bar of the current section
will be changed. If the displayed information is not sufficient, you can open
the function menu by selecting the section once again. In that case, the sections
panel always displays the current section.
The function menu contains the navigation panel and action panel commands.
A command can be added to favorites from the functions menu. To do this, click
the star icon to the left of the command. To remove the command from favorites,
click the asterisk again.
When the function menu is opened, hyperlinks for customizing the navigation
panel (Navigation settings hyperlink) and the action panel (Action settings) for this
subsystem are displayed in the upper right corner.
There are several ways to open the functions menu:
Select a section.
Use a toolbar command (see page 1-105).
1-102 1C:Enterprise 8.3. Developer Guide
3.3.1.5. History
1C:Enterprise saves the history of the user’s actions, which can be used to quickly
access recently opened, created or edited infobase objects (documents, catalog
items, etc.). History contains navigation links to application items, ordered
according to when they were last used. The history can be displayed as either
a history form or as a history panel.
List items are grouped by dates when a given application form has been used.
Moreover, the items are sorted according to the time last used, as displayed to the
right of the item.
The user’s work history is saved in the infobase. The history contains a single
record for each infobase object (a record for a subsequent change replaces the
record of the previous change to that object during a given day). A maximum of
400 records is stored per user. When the number of stored items reaches 400, the
oldest history events will be deleted when new items are added.
If a history list is very large, use the search function to simplify the search for the
required data. A special box at the top of the form can be used to enter the search
request. Press Ctrl + F to open the box or simply start typing the required text.
1-104 1C:Enterprise 8.3. Developer Guide
If the history is displayed in the main window panel (see page 1-106), it will have
the following features:
Items are not grouped by date, the time at which an application item is used
is not shown.
If the panel is placed horizontally, it displays all the elements that can fit
in that space.
If the panel is placed vertically, it displays only the first 10 elements.
Click the panel’s header (History) to open the history form.
You can also use a toolbar command or press Ctrl + Shift + H to open the history
form.
There are several ways in which information is added to the user’s work history:
Interactive operations (open, create, write).
User notification, containing a navigation link to a specific system object,
is displayed (the history then contains the object which is referenced by the
navigation link). For more information on the notification mechanism, please
see page 1-350.
If the user’s work history is changed though a program by means of a global
context property, UserWorkHistory.
If an object is written or opened programmatically, the information about the
object is not included in the history.
3.3.1.6. Favorites
The favorites contains a list of navigation links to different application elements
marked by the user as to be used frequently. Favorites can be displayed as
a favorites form or a favorites panel.
A user may select the most frequently used elements from among the added
elements. Click the icon to the left of the element to add it to the favorites.
Chapter 3. Application Interface 1-105
The element will be in bold, and the next time the favorites is opened, it will be
located in the upper part of the panel and will not be moved. You can also rename
the element or remove it from the list.
If a favorites list is very large, use the search function to simplify finding the
required data. A special box in the upper part of the form can be used to enter the
search request. Press Ctrl + F to open the box or simply start typing the required text.
If the favorites is displayed in the main window panel (see page 1-106), the list
will have the following features:
You cannot search for, rename, delete, or mark an important favorites element.
If the panel is placed horizontally, it displays all the elements that can fit
in that space.
If the panel is placed vertically, it displays only the first 10 elements.
Click the panel’s header (Favorites) to open the favorites form.
You can also use a toolbar command or press Ctrl + Shift + B to open the favorites
form.
The favorites is unavailable unless the user has the right to SaveUserData (see
page 2-1209).
The right part of the form displays the most recent queries entered by the user.
To obtain search results quickly, simply click a hyperlink that contains the
required text.
If full text search is used, you can employ a special language as detailed on page
2-1207.
If the application developer is not satisfied with the system form of the full text
search, it can be replaced via a configuration property, Default search form (see
page 1-167).
You can also use a toolbar command or press Ctrl + Shift + F to open the full text
search form.
The left part of the system commands area contains a button that opens the main
menu of the application. For instance, the main menu contains the View menu to
control the appearance of the main application window.
This menu is used to customize the appearance of the sections panel, the start page,
and the panel layout. This menu also contains a command to hide all the panels
of the main application window (except for the toolbar). Repeat the command to
restore the hidden panels. The toolbar will be oriented as specified by the user
in the panels editor.
The right part of the system commands area contains different service commands
that simplify working with the system and do not depend on the application used,
i.e. printing commands, the commands to obtain a navigation link and to navigate
it, etc.
1-108 1C:Enterprise 8.3. Developer Guide
In the editor, the user can move elements of the main application window (the lower
part of the form with the grey background) to the required location with the mouse.
Elements should be moved inside the light-colored boxes with gray borders. In this
case, the panels will be located in different rows or columns. You can position an
element on top of the existing element. Then elements will be located in one row
or column. The central part of the editor displays the work area of the start page.
A panel cannot be placed here (see fig. 58).
To remove an element, move it back from the schema to an element with a gray
background.
Any elements except for the work area of the main application window can be
removed from the main application window. For instance, you can create a mini-
malistic interface for the application, and the main window will only contain
a work area, toolbars, and an open forms panel (see fig. 59).
When the Default button is pressed, the interface will return to the state specified
by the developer via a configuration property Client application interface (see page
1-168).
Chapter 3. Application Interface 1-109
When an auxiliary window is closed, this does not close the application. There
could be an unlimited number of auxiliary windows, but each infobase object (for
instance, a document or a reference element) can only have one window, i.e. you
cannot open several windows to view the same document, unless this is specified
in the application.
The main form, i.e. a form displayed by default when an auxiliary window
is opened, and opened when the Main command in the form’s navigation panel
is pressed, can be found in the auxiliary window. Clicking other links in the
form’s navigation panel opens auxiliary forms.
The buttons to control the forms are located in all the auxiliary forms.
These buttons have the following functions (from left to right):
A button to navigate to the start page;
Buttons to navigate to the previous/next form help to navigate through a list of
open windows. The button for navigating to the next form becomes active only
after the button for moving to the previous window has been pressed at least once.
Chapter 3. Application Interface 1-111
A button to add the form to a list of favorites (see page 1-104). If a form
is not included in a list of favorites, the color of the asterisk matches the
background of the form. Otherwise, the asterisk is yellow. This button is only
available if the user has the right to SaveUserData (see page 2-1209).
1C:ENTERPRISE
SCRIPT
1C:Enterprise is a flexible configurable system that can be used to solve various
tasks in the area of enterprise automation. Description of specific configuration
algorithms is provided in the 1C:Enterprise Designer or, more specifically,
in program modules that contain texts in the 1C:Enterprise script.
To call this function from the application code, use the following:
Receivables = Catalog.Contractors.GetReceivablesList();
1-118 1C:Enterprise 8.3. Developer Guide
In the command module, you can describe methods using the Export keyword.
However, you cannot use them outside the module. You cannot access commands
and accordingly their context from the 1C:Enterprise script.
4.2.4.1. Comments
You can use comments to make various notes regarding module work. In program-
ming, a good practice is providing a detailed comment with algorithm description
in the source code. In execution mode comments are ignored. In program module
text a comment begins with "//" characters and ends at the end of a string. You can
start a comment at the beginning of a string or write it after an operator in the
same string. You cannot add an operator after the comment in the same string; you
have to finish the comment at the end of the string.
A = B; // This is a comment
// This is also a comment
You can place any number of operators in a string if you separate them with semi-
colons.
There are two categories of operators in program modules: variable declaration
operators and executable operators.
Variable declaration operators create variable names which are used by executable
operators.
Any executable operator may have a label that can be used by the GoTo operator.
Generally, language operator format looks like the following:
~label:Operator[(parameters)] [AddKeyWord];
Labels are special identifiers that begin with a tilde character and consist of
a sequence of letters, digits and underscore characters. To mark an operator, you
should put a label before it followed with a colon.
~label:A=В;
Then
ElseIf
Else
EndIf
For
Each
In
To
While
Do
EndDo
Procedure
Function
EndProcedure
EndFunction
Var
Goto
Return
Continue
Break
And
Or
Not
Try
Except
Raise
EndTry
New
Execute
NOTE
Keyword names are not case sensitive.
Character Description
: End of operator label
; Character separating operators
() Round brackets contain a list of parameters for methods, procedures, functions and/or
wizards.
They can also be used in 1C:Enterprise script expressions
[] Square brackets can be used to call object properties based on property name string
presentation.
You can also call collection items by index or another parameter
, It separates parameters in a list of parameters for methods, procedures, functions and/
or wizards
"" It is used on both sides of string literals
'' It is used on both sides of date literals
. Decimal point in numeric literals.
A separator used to call properties and methods of 1C:Enterprise script objects
+ Addition operation.
Operation of string concatenation
- Subtraction operation
* Multiplication operation
/ Division operation
% It retrieves a remainder in division. Fractional values are permitted for a dividend and
a divisor
> Greater logical operation
>= Greater or equal to logical operation
< Less logical operation
<= Less or equal to logical operation
= Assignment operation
Equal to logical operation
<> Not equal to logical operation
NULL
Description:
Values of this type are used only to specify a missing value for a database,
e.g., for joining tables.
Literal constants:
NULL
Boolean
Description:
Values of this type may have two values – True and False specified by corre-
sponding literal constants. Values of this type result from evaluation of logical
expressions.
Note:
Comparison operations of the 1C:Enterprise script use logical expressions.
It means that you do not have to write the following in a comparison expression:
If MyVariable = True Then
EndIf;
EndIf;
Literal constants:
True
False
Date
Description:
Values of this type contain date (AD, from January 01, 0001) and time with
accuracy up to one second.
Literal constants:
A string of digits enclosed in single quotation marks with a format of
'YYYYMMDDhhmmss', where:
YYYY – four digits of a year (including age and millennium)
MM – two digits of a month
1-124 1C:Enterprise 8.3. Developer Guide
Number
Description:
Any decimal number can be represented by numerical type. For numerical
types, the main arithmetic operations are defined: addition, subtraction, multi-
plication and division.
IMPORTANT!
A number cannot have more than 32 digits.
Literal constants:
A set of digits written directly in the source code, with the following syntax:
[+|-]{0|1|2|3|4|5|6|7|8|9}[.{0|1|2|3|4|5|6|7|8|9}]
A period is used to separate the whole and fractional parts.
Example:
A = 15;
B = -968.612;
String
Description:
Values of this type contain a string of arbitrary length in Unicode format.
Literal constants:
String type literal constants are sets of values in double quotation marks.
To use the " character (double quotation mark) in a string, use two double
quotes in a row ("").
Chapter 4. 1C:Enterprise Script 1-125
Besides, you can use string constants that occupy several lines. To specify
a multi-line constant in the source text, you can use one of two methods:
There should be no other characters except spaces, line breaks and comment
lines between fragments that represent separate lines of a multi-line string.
Each part of a multi-line string does not end with a quotation mark, but all
lines end in a | character (vertical line). In this case comments are allowed
if the string starts with the comment sign, //.
Example:
// Sample string
MyString = "This is a correct string";
Displaying or printing the CompanyName line (sample string 3) results in the
following:
"Cornflower" Inc
Undefined
Description:
This type of value is used when you need an empty value that does not belong
to any other type. For example, this is the initial value received by composite
type attributes. There is only one possible value for this type specified by
a literal value.
Literal constants:
Undefined
Type
Description:
Values of this type are used to identify value types. This is required for type
definition and comparison. This type has no literal constants and is returned by
TypeOf and Type functions of the 1C:Enterprise script (see below).
1-126 1C:Enterprise 8.3. Developer Guide
Parameters:
<Assignment>
Any writable variable or property of 1C:Enterprise script object may act as an
assignment.
<Source>
An expression with a value that needs to be assigned.
Example:
A = В;
Page1 = "777";
DocumentDate = '20020717';
Arithmetic operations have one or two operands which determine operation seman-
tics. Semantics of an operation depend on the first operand. If the second operand
type does not match the required one, the value is converted into the required type
in compliance with type conversion rules. If the type of the first operand does not
match any of the valid types, depending on situation, types may be converted or an
execution error may occur.
Operation Description of Action
Addition is defined for the Number + Number
following operand types Date + Number (number of seconds is added to the date)
Subtraction is defined for the Number - Number
following operand types Date - Number (number of seconds is subtracted from the date)
Date - Date (result is the difference between two dates in seconds)
Multiplication Number * Number
Division Number / Number
Remainder in Division Number % Number
Boolean operations:
The following types of Boolean operations are defined in the 1C:Enterprise
script:
AND Conjunction (Boolean AND)
OR Disjunction (Boolean OR)
NOT Logical negation (Boolean negation NOT)
Logical expressions are calculated from left to right. Use round brackets to
avoid ambiguity and manage operand sequence.
Logical operation seniority levels:
Level 1 operands in round brackets
Level 2 NOT
Level 3 AND
Level 4 OR
NOTE
When a logical expression is calculated, only its required parts are used. For
example, if Price <= 0 in the expression (Price > 0) AND CheckSum(), then
CheckSum() function is not called.
Syntax:
?(<Logical expression>, <Expression 1>, <Expression 2>)
Parameters:
<Logical expression>
The evaluated logical expression that defines which of the resulting expressions
is calculated. If the evaluation result is True, then <Expression 1> is calcu-
lated. If the evaluation result is False, then <Expression 2> is calculated.
<Expression 1>
The resulting expression that is calculated if the logical expression is evaluated
as True.
<Expression 2>
The resulting expression that is calculated if the logical expression is evaluated
as False.
Return value:
Calculation result for one of the resulting expressions.
Example:
Status = ?(GetDiscount() > 10,"Preferred Customer", "Regular Customer");
Warning(Status);
Raise
Description:
This operator form is used to raise a new exception.
Syntax:
Raise <Expression>
Parameters:
<Expression>
The expression is evaluated to a string that is used as exception description.
Example:
Raise "Cannot post the document";
See also:
Description of Try operator.
1-130 1C:Enterprise 8.3. Developer Guide
Execute
Description:
This operator is used to execute a code fragment passed as a string value.
IMPORTANT!
It is not recommended to use this method to implement a significant portion of
functionality in application solutions.
NOTE
Executable code should not contain separate procedures or functions since the
code itself is executed as a procedure or a function which uses this operator.
The code also should not contain explicit declaration of variables.
Syntax:
Execute(<String>)
Parameters:
<String>
A string containing executable code text.
Example:
// Displays the current date in the message window
Execute("Message(CurrentDate())");
AddHandler
Description:
It adds an event handler.
When adding an event handler a check is performed to make sure that the
number of event parameters matches the number of parameters for the method
assigned as a handler.
Syntax:
AddHandler <Event>, <EventHandler>;
Parameters:
<Event>
The event to which the handler is added.
The event is set in the <Expression>.<EventName> form where:
<Expression> is any expression in the 1C:Enterprise script. It should
result in an object with an event to which the handler is added.
<EventName> is the event ID (name).
Chapter 4. 1C:Enterprise Script 1-131
<EventHandler>
A procedure or function that acts as event handler.
The event handler can be a method of 1C:Enterprise script object. Then
<EventHandler> is set as <Expression>.<HandlerName> where:
<Expression> is any expression in the 1C:Enterprise script that is evalu-
ated to the object whose method serves as the event handler.
<HandlerName> is the event handler method name.
A procedure or function within the scope can be also set as the event handler.
In this case the event handler is specified using the name of this procedure or
function.
You can subscribe to events that have the same name (in COM objects) and
a different number of parameters. To do so, you should create multiple handlers
in the 1C:Enterprise script (each with a unique name and the required number
of parameters); then the subscription mechanism selects a handler matching
a particular subscription.
Example:
DataProcessor = DataProcessors.DocumentCheck.Create();
Invoice = Documents.Invoice.CreateDocument();
AddHandler Invoice.OnWrite, DataProcessor.OnWriteDocument;
Procedure OnDocumentChange()
Message("Document is changed");
EndProcedure
For
Description:
For operator is used for loop-like repetition of operators within Do – EndDo
clause. Before the loop, <Expression 1> value is assigned to <Variable
Name> variable. <Variable Name> value automatically increments at each
iteration. Incremental step equals 1 for each loop. The loop is executed while
<Variable Name> is less or equal to <Expression 2> value. The loop
condition is always checked at the beginning before the loop is executed.
Syntax:
For <Variable Name> = <Expression 1> To <Expression 2> Do
// Operators
[Break;]
// Operators
[Continue;]
// Operators
EndDo;
Parameters:
<Variable Name>
An ID for a variable (loop counter) whose value is auto-incremented by 1 on
each iteration. It is the so-called loop counter.
<Expression 1>
A numeric expression that sets the initial value assigned to the loop counter at
the first iteration.
To
Syntax link for the <Expression 2> parameter.
<Expression 2>
Maximum value of the loop counter. When the <Variable Name> variable
becomes greater than <Expression 2>, execution of For operator is stopped.
Do
Operators after the Do keyword are executed while the <Variable Name>
value is less or equal to <Expression 2>.
// Operators
An executable operator or a sequence of such operators.
Chapter 4. 1C:Enterprise Script 1-133
Break
It breaks loop execution at any point. After this operator is executed, control
is passed to the operator following the EndDo keyword.
Continue
It passes control immediately to the beginning of the loop where loop condi-
tions are evaluated and checked. Operators following this operator in the
loop body are skipped in this iteration.
EndDo
Keyword that denotes the end of a loop operator structure.
Example:
// Cycling through days in the current month
LastMonthDay = Day(MonthEnd(CurrentDate()));
For CurDay = 1 To LastMonthDay Do
State("Processing day: "+ CurDay);
EndDo;
For each
Description:
For each operator is used for cycling through a collection of values. Each
iteration returns a new collection item. The cycle is running until all collec-
tion items are processed. You can use the Break operator to stop the cycle at
any time.
Syntax:
For each <Variable Name 1> In <Variable Name 2> Do
// Operators
[Break;]
// Operators
[Continue;]
// Operators
EndDo;
Parameters:
<Variable Name 1>
Value of the next collection item is assigned to this variable on each cycle.
1-134 1C:Enterprise 8.3. Developer Guide
In
Syntax link for <Variable Name 2>.
<Variable Name 2>
A variable or an expression that represents a collection. Items of this collection
are assigned to <Variable Name 1>.
Do
Operators following the Do keyword are executed until the cycle goes through
all collection items.
// Operators
An executable operator or a sequence of such operators.
Break
It breaks loop execution at any point. After this operator is executed, control
is passed to the operator following the EndDo keyword.
Continue
It passes control immediately to the beginning of the loop where loop conditions
are evaluated and checked. Operators following this operator in the loop body
are skipped in this iteration.
EndDo
Keyword that denotes the end of a loop operator structure.
Example:
// Cycling through lines of a tabular section of the document.
Document = Documents.Invoice.FindByCode(12345);
If
Description:
If operator controls program execution based on a result of one or more
logical expressions. The operator may contain any number of operator groups
within ElseIf – Then clauses.
Chapter 4. 1C:Enterprise Script 1-135
Syntax:
If <Logical Expression> Then
// Operators
[ElseIf <Logical Expression> Then]
// Operators
[Else]
// Operators
EndIf;
Parameters:
<Logical Expression>
A logical expression.
Then
Operators following Then are executed if the result of the logical expression
is True.
// Operators
An executable operator or a sequence of such operators.
ElseIf
A logical expression after ElseIf keyword is evaluated only when all condi-
tions in If and all previous ElseIf clauses are False. Operators following
ElseIf – Then are executed only when the result of the logical expression
in this ElseIf is True.
Else
Operators following the Else keyword are executed if all previous If and
ElseIf conditions are False.
EndIf
Keyword that ends a conditional execution structure.
Example:
If WeekDay(CurrentDate()) = 6 Then
Message("It’s Saturday.");
ElseIf WeekDay(CurrentDate()) = 7 Then
Message("It’s Sunday.");
Else
Message("It’s a working day.");
EndIf;
1-136 1C:Enterprise 8.3. Developer Guide
New
Description:
You can use this operator to create a value of specified type. This operator can
be used only for types that allow creation of new values. You should use func-
tional form of the New operator (version 2) for application objects, since module
check in the Designer has no types defined for application objects.
Syntax (version 1):
New <Type name>[(<Param 1>, ..., <Param N>)]
Parameters:
Type name
It specifies the type name for the new value.
<Param 1>, ..., <Param N>
The type name can be followed by parameters in brackets if they are defined
in wizards for this type. A valid number of parameters and their purpose are
specified in object wizard descriptions.
Example:
// Creating a three-item array.
Array = New Array(3);
Parameters:
Type
Type name or Type value.
<Wizard parameters>
Array of wizard parameters.
Example:
ValueType = Type("StringQualifiers");
Parameters = New Array(2);
Parameters[0] = 20;
Parameters[1] = AllowedLength.Variable;
StrQualif = New(ValueType, Parameters);
Chapter 4. 1C:Enterprise Script 1-137
Goto
Description:
Unconditional control transfer to another operator of the program. It transfers
control from one operator to another.
The scope of this operator is limited by the program module, procedure or
function; this operator cannot pass control outside the program module, proce-
dure or function.
NOTE 1
Label in this operator should not lead to Procedure or Function operator.
NOTE 2
The operator of unconditional transfer cannot be used to pass control to operators
within the following clauses from outside: While – EndDo, For – EndDo, For
each – EndDo, If – EndIf, Try – Except – EndTry.
Syntax:
Goto <Label>;
Example:
Goto ~Label1;
...
~ Label1: Message("Transferred to label.");
Var
Description:
This operator is used for explicit variable declaration.
Syntax:
Var <Variable name 1> [Export] [, <Variable name 2>, …];
Parameters:
<Variable name 1>[, <Variable name 2>, …]
It sets a name or names of declared variables.
Export
An optional keyword. It means that this variable is exposed when other
modules access context of this module. This keyword should be specified
individually for each declared variable. It is meaningless in declarations of
variables for standalone procedures or functions.
1-138 1C:Enterprise 8.3. Developer Guide
Example:
// A single variable declaration example
Var А Export;
Var B;
While
Description:
While operator is used for cyclic repetition of operators within Do – EndDo
clause. The cycle is running while the logical expression is True. The loop
condition is always checked at the beginning before the loop is executed.
Syntax:
While <Logical expression> Do
// Operators
[Break;]
// Operators
[Continue;]
// Operators
EndDo;
Parameters:
<Logical expression>
A logical expression.
Do
Operators following Do are executed while the result of a logical expression
is True.
// Operators
An executable operator or a sequence of such operators.
Break
It breaks loop execution at any point. After this operator is executed, control
is passed to the operator following the EndDo keyword.
Continue
It passes control immediately to the beginning of the loop where loop conditions
are evaluated and checked. Operators following this operator in the loop body
are skipped in this iteration.
EndDo
Keyword that denotes the end of a loop operator structure.
Example:
SelectionDoc = Documents.Invoice.Select();
EndDo;
Try
Description:
Try operator manages program execution based on error (exceptional) situa-
tions and defines how these situations are handled.
Exceptions or error situations are module runtime errors. Custom exceptions are
not supported.
If a runtime error occurs while executing a sequence of operators, execution of
the operator causing the error stops, and control is passed to the first operator
of the exception operator sequence. Control is passed to the operator even if
the error was caused by an operator within a procedure or function called from
a Try operator. If the error occurred in a procedure or function, it is termi-
nated, and its local variables are destroyed. It applies to any level of nested
calls. After the exception operator sequence is executed, control is passed to
the operator following the EndTry keyword. If the sequence of Try operators
is executed without errors, then the exception operator sequence is skipped,
and control is passed to the operator following the EndTry keyword.
Try – Except – EndTry clauses can be nested. If an exception is raised, control
is passed to the handler where a Try operator caused the error. If Raise oper-
ator is executed in the exception operator sequence of this handler, control
is transferred to a higher level exception handler and so on. If there is no
exception handler at a higher level, the exception is handled by the system,
and the program module is terminated.
Built-in ErrorDescription() and ErrorInfo() functions can be useful
in troubleshooting (see description of 1C:Enterprise script functions).
Syntax:
Try
// Try operators
Except
// Exception operators
[Raise;]
// Exception operators
EndTry;
Chapter 4. 1C:Enterprise Script 1-141
Parameters:
// Try operators
An executable operator or a sequence of such operators.
Except
Operators following the Except keyword are executed if a runtime error occurs
while executing a sequence of operators.
// Exception operators
An executable operator or a sequence of operators that process an exception.
Raise
This operator allows you to raise an exception in cases when it is required to
shut down a module and generate a runtime error, even though the exception
has been processed. It is only allowed within the Except – EndTry clause.
This operator aborts exception operators and searches for an external excep-
tion handler (for nested tries). If such an exception handler is found, control
is passed to it. Otherwise the exception is handled by the system, a message
about the original error is generated, and the module is terminated.
EndTry
Keyword that ends the exception handling clause.
Example:
Procedure MakeInExcel()
Try
// Trying to call MS Excel
Table = New ComObject("Excel.Application");
Except
Warning(ErrorDescription());
Return;
EndTry;
Procedure
Description:
Procedure keyword identifies the beginning of a source code area that can
be called from any point of the program module using ProcedureName()
operator with a list of parameters (use round brackets even if no parameters
are passed). If an application module or a common program module contains
1-142 1C:Enterprise 8.3. Developer Guide
the Export keyword in the body of procedure description, it means that this
procedure is accessible from all other configuration modules.
When the Return operator is executed, the procedure ends and returns control to
the point of call. If procedure text does not contain the Return operator, then an
implied Return operator is executed after the last executable operator. The end
of the procedure program area is identified by the EndProcedure operator.
Variables declared in the procedure body in Local Variable Declarations area
are local variables and therefore they are only available in this procedure
(except when they are used as parameters for calling other procedures, functions
or methods).
NOTE
Procedure and EndProcedure keywords are not operators; they are operator
brackets. Therefore, they should not end with a semicolon (this may cause mod-
ule execution errors).
Syntax:
Procedure <ProcedureName>([[Val] <Param 1> [=<DefVal>], ...
,[Val] <Param N>[=<DefVal>]])[Export]
// Local Variable Declarations;
// Operators;
...
[Return;]
// Operators;
...
EndProcedure
Parameters:
<ProcedureName>
It assigns a procedure name.
Val
Optional keyword which specifies that the following parameter is passed
by value, i. e. changing the formal parameter value does not affect the actual
parameter passed during procedure call. If this keyword is not specified, the
procedure parameter is passed by reference, i. e. changing the formal parameter
value in the procedure will change the actual parameter value.
<Param 1>, ..., <Param N>
Optional list of formal parameters separated by commas. Values of formal
parameters should correspond to values of actual parameters passed when the
procedure is called. This list defines a name for each parameter as it is used
in the procedure text. The list of formal parameters can be empty.
Chapter 4. 1C:Enterprise Script 1-143
=<DefVal>
Optional setting of default parameter value. You can place parameters with
default values anywhere in the list of formal parameters (for more details see
section "Passing Procedure and Function Parameters").
Export
Optional keyword specifying that this procedure is accessible from other
program modules.
// Local Variable Declarations
It declares local variables that can be referenced within this procedure only (see
Var operator description).
// Operators
Executable procedure operators.
Return
Optional keyword that ends the procedure and returns to the point of the
program that called the procedure. This operator is not required.
EndProcedure
Required keyword that identifies the end of the source text of the procedure
and ends the procedure. It returns to the point of the program that called the
procedure.
Example:
Var Glob;
// Procedure description
Procedure MyProcedure(Par1, Par2, Par3) Export
Glob = Glob + Par1 + Par2 + Par3;
Return;
EndProcedure
Glob = 123;
MyProcedure(5, 6, 7); // Procedure call
RemoveHandler
Description:
It removes an event handler.
When removing an event handler a check is executed to make sure that the
number of event parameters matches the number of parameters for the method
assigned as handler.
1-144 1C:Enterprise 8.3. Developer Guide
Syntax:
RemoveHandler <Event>, <EventHandler>;
Parameters:
<Event>
An event for which the handler is removed.
The event is set in the <Expression>.<EventName> form, where:
<Expression> is any expression in the 1C:Enterprise script. It should
result in an object with an event for which the handler is removed.
<EventName> is the event ID (name).
<EventHandler>
A procedure or function that acts as the event handler.
The event handler can be a method of 1C:Enterprise script object. Then
<EventHandler> is set as <Expression>.<HandlerName> where:
<Expression> is any expression in the 1C:Enterprise script. It should
result in an object whose method is used as the event handler.
<HandlerName> is the method name of the event handler.
A procedure or function within the scope can be also set as the event handler.
In this case the event handler is specified using the name of this procedure or
function.
Example:
RemoveHandler Invoice.OnWrite, DataProcessor.OnWriteDocument;
Function
Description:
Function keyword begins an area in the source text of a function that
can be initiated from any point of the program module by specifying Func-
tionName with a list of parameters (use round brackets, even if no parameters
are passed). If an application module or common program module contains
Export keyword in the body of function description, it means that this func-
tion is accessible from all other configuration modules.
Function execution should end with the Return operator. The difference
between functions and procedures is that functions return a ReturnValue.
EndFunction operator identifies the end of the function.
You can record any function call in the program module as a procedure call,
i. e. it is allowed not to accept a return value from a function.
Chapter 4. 1C:Enterprise Script 1-145
If the Return keyword is not included in the function body or the module
string containing this keyword is not executed, the function returns an Unde-
fined value.
Variables declared in the Local Variable Declarations area of a function body
are local for this function and are accessible only in this function (except when
they are used as parameters for calling other procedures, functions or methods).
NOTE
Function and EndFunction keywords are not operators; they are operator
brackets. Therefore, they should not end with a semicolon (this may cause mod-
ule execution errors).
Syntax:
Function <FunctionName>([[Val] <Param 1>[=<DefVal>], ... ,[Val]
<Param N>[=<DefVal>]])[Export]
// Local Variable Declarations;
// Operators;
...
Return <Return value>;
// Operators;
...
EndFunction
Parameters:
<FunctionName>
It assigns a function name.
Val
Optional keyword specifying that the following parameter is passed by value,
i.e. changing the value of the function parameter does not influence the actual
parameter that is passed during function call. If this keyword is not specified,
the procedure parameter is passed by reference, i. e. changing the formal
parameter value in the procedure will change the actual parameter value.
<Param 1>, ..., <Param N>
Optional list of formal parameters separated by commas. Values of formal
parameters should correspond to values of actual parameters passed when the
function is called. This list defines a name for each parameter as it is used
in the function text. The list of formal parameters can be empty.
=<DefVal>
Optional setting of default parameter value. You can place parameters with
default values anywhere in the list of formal parameters (for more details see
section "Passing Procedure and Function Parameters").
1-146 1C:Enterprise 8.3. Developer Guide
Export
Optional keyword specifying that this function is accessible from other
program modules.
// Local Variable Declarations
It declares local variables that can be referenced in this function (see Var oper-
ator description).
// Operators
Executable function operators.
Return <Return value>
Keyword that ends the function and returns the specified value into the caller
expression.
The return value can be any expression or variable that has a value containing
the function call result.
EndFunction
Keyword that identifies the end of the function source text.
Example:
Var Glob;
// Function description
Function MyFunction(Par1, Par2, Par3) Export
Glob = Glob + Par1 + Par2 + Par3;
Return Glob;
EndFunction
Glob = 123;
Res = MyFunction(5, 6, 7); // Function call
Syntax:
<Object>[<Property Name>]
Parameters:
<Object>
Object with a property being called.
<Property Name>
String type. The name of the property to be called.
Example:
Cat = Catalogs.Nomenclature.FindByCode(SoughtCode);
// You will get the current document where the cursor is positioned.
CurDoc = FormElements.LogList.CurrentRow;
EndProcedure
1-148 1C:Enterprise 8.3. Developer Guide
4.7.3.1. Call without Transferring Control from the Client to the Server
If a call is executed without transferring control between the client and the
server (the call is executed only on the client side or only on the server side), by
default the parameters are passed by reference. In this case, a change in a formal
parameter changes the corresponding actual parameter. You can use the Val modi-
fier before a formal parameter name to specify that the parameter is to be passed
by value. In this case, you can't change an actual parameter value by assigning
a value to a formal parameter.
&AtClient
Procedure MyProcedure()
A = 100;
ByRef(A);
// Variable (A) = 40, because in the body of the procedure
// the Parameter1 parameter value was changed to 40.
// Variable (A) was modified because the parameter was passed by reference.
A = 100;
ByValue(A);
// Variable (A) = 100, although that in the body of the procedure
// the Parameter1 value parameter changed to 40.
// Variable (A) was not modified, because parameter passed by value.
EndProcedure
&AtClient
Procedure ByRef(Parameter1)
Parameter1 = 40;
Chapter 4. 1C:Enterprise Script 1-149
EndProcedure
&AtClient
Procedure ByValue(Val Parameter1)
Parameter1 = 40;
EndProcedure
However, you should note the following: if an aggregate object is passed as
a parameter, you cannot assign another value to the actual parameter. But you
can modify the passed object. For example, if you pass an array to a procedure by
value, you can clear the array using the Clear() method, but you cannot change
the parameter value in the calling procedure.
&AtClient
Procedure MyProcedure()
You also need to consider the specifics of variable storage when calls are imple-
mented:
&AtClient
Procedure TestProcedure()
ValueA = New Array;
ValueA.Add(1);
ValueA.Add(2);
ValueB = ValueA;
1-150 1C:Enterprise 8.3. Developer Guide
MyProcedure(ValueA, ValueB);
// After completion of the call procedure both variables (ValueA and // ValueB) reference at one array.
// There are the following values in the array:
// ValueA[0] = ValueB[0] = "(A)"
// ValueA[1] = ValueB[1] = "B"
EndProcedure
&AtClient
Procedure MyProcedure(Parameter1, Parameter2)
// Although that there are two parameters, in fact only ine array is // processed
Parameter1[0] = 5;
Parameter1[1] = 6;
Parameter2[0] = "A";
Parameter2[1] = "B";
EndProcedure
In this case you should note that the assignment operation ValueB = ValueA;
(in TestProcedure()) will not create a copy of the array in the ValueA variable.
Both variables will refer to the same array.
Parameters are passed to MyProcedure() by reference, so if you change two
formal parameters, one physical array is changed.
4.7.3.2. Call with Transferring Control from the Client to the Server
Calling procedures and functions while you are transferring control between the
client and the server are characterized by the fact that, in general, such calls change
the computer where the called method is executed. This happens because the
client works on one computer and the server works on another. Thus we can't talk
about passing parameters by reference, as a single computer can't get direct access
to another computer’s memory. In the file server variant, the client and the server
represent one computer, but this does not affect interaction logic. So the parameters
are passed as follows in client/server interaction:
When control is transferred from the client to a server (and vice versa), param-
eter copies are always passed. When server procedure or function is called
from the client, a copy of an actual parameter is created and transferred to the
server side. When control is returned from the server to the client, a copy of
an actual parameter (one which was used in the called procedure or function)
is also created to transfer it back to the client.
Chapter 4. 1C:Enterprise Script 1-151
If a formal parameter is specified with the Val modifier, the parameter value
will be passed only when a procedure or function is called, but it will not be
passed back when control is returned to the client.
If the same real value is specified for several formal parameters, a number of
real value copies will be created that equals the number of formal parameters
using the value.
If a value of the same variable is specified as formal parameters, then after
control is returned from the server this variable value is set as the most proper
formal parameter (without the Val modifier) that was changed in the called
function.
&AtClient
Procedure TestProcedure(Command)
ValueA = New Array;
ValueA.Add(1);
ValueA.Add(2);
ValueB = ValueA;
&AtServer
Procedure ServerProcedure(Parameter1, Parameter2)
Remember that a copy of the value is created when parameters are passed to
a server. This can help avoid hard to diagnose errors in system operation. Let us
consider the following example:
&AtClient
Procedure TestProcedure(Command)
ValueA = New Array;
ValueA.Add(1);
ValueA.Add(2);
ValueB = ValueA;
Structure = New Structure("Key1, Key2", ValueA, ValueA);
ServerProcedure(Structure);
ValueA[0] = 9;
ValueA[1] = 8;
ValueB[0] = "C";
ValueB[1] = "D";
EndProcedure
&AtServer
Procedure ServerProcedure(Parameter1)
Parameter1.Key1[0] = "0";
Parameter1.Key1[1] = "1";
Parameter1.Key2[0] = "2";
Parameter1.Key2[1] = "3";
EndProcedure
After the TestProcedure() call is completed, the variables will have the
following states:
The ValueA and ValueB arrays are identical and contain the value "С" in the
first element and the value "D" in the second element, since the ValueB vari-
able refers to an array of the ValueA variable, and values of these variables are
not passed to the server.
The Structure variable will hold two arrays:
○○ with the values "0" and "1" for array elements located in structure element
with Key1 key;
○○ with values "2" and "3" for array elements located in the structure element
with the Key2 key;
○○ such behavior is due to the fact that when the procedure is called, a copy
is created not only for the parameter itself (the Structure variable), but for
all the objects in this structure; two arrays that initially referred to one array
with 0 and 1 element values.
Chapter 4. 1C:Enterprise Script 1-153
If the parameter does not have a default value, you can omit it in the list of the
actual passed parameters when calling a procedure or function, but you should use
a comma separator.
If you omit the parameter when calling the procedure, it is either assigned
a default value (if any) or the Undefined value.
Procedure MyProcedure(Parameter1, Parameter2, Parameter3 = "Default")
…
EndProcedure
You still have to use round brackets if you do not pass any parameters during the
method, procedure or function call (an empty parameter list). Do not pass data from
the client to the server (and vice versa) and do not serialize the data with cyclic
references. In this case an error will be shown and the session will be terminated.
When you pass string values from the client to the server and vice versa, remember
that these values should not contain characters that are invalid according to the
XML version 1.0 specification (http://www.w3.org/TR/xml/).
TIP
You can perform such validation at server side using the FindDisallo-
wedXMLCharacters() function.
1-154 1C:Enterprise 8.3. Developer Guide
Example:
// Retrieve enumeration value.
Type = Enums.ProductTypes.Product;
○○ChartOfChartOfCharacteristicTypes
○○ChartOfChartOfAccounts
○○ChartOfChartOfCalculationTypes
○○Enum
○○BusinessProcess
MetadataObjectName – specify a metadata object name as it is set in the
Designer.
Value – it can be one of the following:
○○ enumeration value name for enumerations
○○ name of predefined value to be obtained as it is set in the Designer
○○ RoutePoint.PointName – point in the business process route
○○ EmptyRef, if you want to retrieve an empty reference.
If you want to retrieve a route point for a business process, the string describing
the value to be obtained will look like the following:
Example:
// Retrieve enumeration value.
Type = PredefinedValue("Enum.ProductTypes.Product");
If you need to get the system enumeration value, the method parameter will appear
as follows: SystemEnumerationName.SystemEnumerationValue.
Example:
ChartType = PredefinedValue("ChartType.ConcaveSurface");
Assume the form module source code contains the following construct:
&AtClient
Procedure WorkWithFiles()
// program code 1
// runs at the web client only
#Else
// program code 2
// runs at other clients
#EndIf
EndProcedure
&AtClient
Procedure Client()
EndProcedure
#EndIf
Below you can see a list of preprocessor instructions with a brief description:
Server, AtServer – defines a server.
Client, AtClient – defines any client.
ThinClient – defines a thin client.
WebClient – defines a web client.
ExternalConnection – defines an external connection.
ThickClientManagedApplication – defines managed application mode
for the thick client.
ThickClientOrdinaryApplication – defines ordinary mode for the thick
client.
MobileAppClient – defines the client part of the mobile application.
MobileAppServer – defines the server part of the mobile application.
The table below specifies preprocessor instructions defined in various 1C:En-
terprise operation modes:
ThickClientManagedApplication
ThickClientOrdinaryApplication
ExternalConnection
MobileAppServer
MobileAppClient
Server, AtServer
Client, AtClient
ThinClient
WebClient
Mode
Client/server mode
Server side +
Thick client in ordinary mode + +
Thick client in managed mode + +
Thin client + +
Web client + +
External connection +
File-server version
Thick client in ordinary mode + + +
Thick client in managed mode + + +
Thin client + +
Server side of thin client +
Web client + +
External connection +
In a mobile application client +
On the server side of the mobile application +
Chapter 4. 1C:Enterprise Script 1-161
If you are using a non-global common module that is set to be used at any client
and at server, then methods enclosed in #If Server Then #EndIf are only
available if they are called at the server side. You cannot call these methods at the
client side.
Server and AtServer instructions are identical.
Client and AtClient instructions are also identical.
NOTE
Before a program module is passed to a thin or web client, the server processes
preprocessor instruction in the module. Code in the 1C:Enterprise script that
is not executed at the client side is replaced with white spaces (i.e. removed).
However, line break and tab characters are retained.
Language construct
<Language construct> = <Variable description> | <Procedure
description> | <Function description>
For a detailed description of language constructs see page 1-128.
AtClient
AtServer
AtServerNoContext
AtClientAtServerNoContext
AtClientAtServer
Region
EndRegion
Below you can see a list of compiler directives with a brief description:
AtClient – method is executed at the client side in a form context.
A variable lives as long as the client-side form.
1-162 1C:Enterprise 8.3. Developer Guide
You can access client variables of the form module from the method.
You are allowed to call any methods.
AtServer – method is executed at the server side in a form context.
Lifetime of a variable lasts as long as server call execution.
You can access server variables of the form module from the method.
You are allowed to call:
○○ server methods
○○ server out-of-context methods
○○ client/server out-of-context methods
○○ methods of non-global common server modules
AtServerNoContext – method is executed at the server outside the form
context.
Variables cannot be preceded by this compilation directive.
You cannot access variables of the form module from the method.
You are allowed to call:
○○ server out-of-context methods
○○ client/server out-of-context methods
○○ methods of non-global common server modules
AtClientAtServerNoContext – method is executed both at the client and
at the server, outside the form context.
Variables cannot be preceded by this compilation directive.
You cannot access variables of the form module from the method.
You are allowed to call:
○○ server out-of-context methods
○○ client/server out-of-context methods
○○ methods of non-global common server modules
○○ methods of non-global common modules with Server and Client
(managed application) check boxes
AtClientAtServer – method is executed both at the client and at the
server.
Variables cannot be preceded by this compilation directive.
You are allowed to call:
○○ server out-of-context methods
○○ client/server out-of-context methods
○○ methods of non-global common server modules
○○ methods of non-global common modules with Server and Client
(managed application) check boxes
Chapter 4. 1C:Enterprise Script 1-163
NOTE
If an object is unavailable in a client application, the type of this object
is also unavailable in this client application. For instance, if object
CatalogObject.Contractors is unavailable within a thin client,
Type("CatalogObject.Contractors") is also unavailable in a thin client.
1-164 1C:Enterprise 8.3. Developer Guide
CONFIGURATION OBJECTS
This chapter contains instructions for working with the entire configuration and
describes modes and mechanisms that are used for all configuration objects.
Creation and setup of the main configuration objects (constants, catalogs, docu-
ments, sequences, logs, enumerations, reports, data processors and registers) and
some other objects located in the Common configuration branch (filter criteria and
styles) are described in the documentation using an example of the object editing
window (see page 59 for more details). The same can be done using the object
properties palette.
External Connection Module – click the Open link to open the application module
editing window (see page 1-172).
Use managed forms in ordinary application – specifies that managed forms need to
be used in the ordinary application mode of the thick client. Selecting this check
box changes rules of form selection in the thick client (for details see page 1-263)
and rules of centralized configuration check (for details see page 2-1025).
NOTE
This property is only available if the configuration editing mode is set to Managed
application and ordinary application.
Use ordinary forms in managed application – specifies that ordinary forms need to
be used in the managed application mode of the thick client. Selecting this check
box changes rules of form selection in the thick client (for details see page 1-263)
and rules of centralized configuration check (for details see page 2-1025).
NOTE
This property is only available if the configuration editing mode is set to Managed
application and ordinary application.
Client application interface – is used to setup the default panel layout for the Taxi
interface. The interface will change to this if a user clicks Default in the panel
editor (see page 1-108).
Default Language – specify default language for the configuration.
Brief Information – brief information on the configuration.
Detailed Information – detailed information on the configuration (multiple lines
allowed).
Logo – select a logo. Make your selection in the standard picture selection
window:
NOTE
A logo must be 64x64 pixels or smaller. Picture type may be any of those sup-
ported by the 1C:Enterprise system.
Splash – use this option to select a splash. A splash is selected in the standard
picture selection window. The picture to be used as a splash must be 600x255
pixels. Transparency is not supported.
NOTE
The splash screen picture must meet the following requirements: 305x110 pixels
in size; you can set transparent color when selecting the picture. Picture type may
be any of those supported by the 1C:Enterprise system.
Copyright – information on the configuration author.
Vendor information address – link to the information about the configuration vendor
(specified in the Copyright property). The address can be set with a schema prefix
(http://) or without it.
Configuration information address – link to information about the configuration.
The address can be set with a schema prefix (http://) or without it. The About
1C:Enterprise window displays the following data: configuration Synonym, Config-
uration information address property, Copyright property and Vendor information
address property.
Chapter 5. Configuration Objects 1-169
Default Constants Form – select the default form for input and editing of constants
in the configuration. This form is selected from among the common forms (see page
1-229) in Common – Common forms. For details on the various forms, see page 1-263.
NOTE
This property is only available if the configuration editing mode is set to Managed
application and ordinary application.
The Default report form, Default report settings form and Default report variant form
properties can be used to specify the default forms that will be used by reports
without the corresponding form being specified. For example, you can create
a default report form containing some features that should be present in all appli-
cation forms, such as sending the report generated by e-mail. To solve such a task,
you need to create a default report form, implement all the necessary commands
and specify it in the Default report form configuration property. After this action
all reports for which a default report form is not specified will use the default form
you created.
Default dynamic list settings form specifies a general form to be used to edit the
dynamic list settings in the application. If this property is not set, an automatically
generated settings form will be used to edit the dynamic list settings.
The property Default search form specifies a general form to be used instead of
a system form for a full text search, which can be called in the Taxi interface from
the toolbar or through a keyboard shortcut.
5.1.3. Development Property Category
Properties in this category describe data on configuration vendor and version (for
details see page 2-1122).
Update directory address – contains address of a resource that can be used to
update the application solution.
for making different forms in the data exchange mechanism and they also contain
common modules and templates of print forms accessible from any configuration
module.
5.5.1. Subsystems
For a description of subsystem purposes see page 1-343.
NOTE
Setting Desktop as a subsystem name is not recommended.
The number and nesting levels of objects at the Subsystems branch are unlimited.
To view configuration objects for a specified set of subsystems, you can set an
object filter in the Configuration window. Select Actions – By Subsystems in the
Configuration window and specify a required set of subsystems, then set additional
filter criteria, Include objects from subordinate subsystems and Include objects from
parent subsystems.
The subsystem list contains a special item, <Not included in subsystems>, which
you can use to select only those objects that do not belong to any subsystem.
NOTE
When filtering by subsystems is set, key configuration object tree branches
without filtered objects are not shown.
The user interface defines whether configuration objects belong to a particular
subsystem.
The Subsystems configuration object property value can be accessed in the
program using the 1C:Enterprise script tools. This provides additional options for
data filtering.
The Move subsystem command in the context menu can be used to change
subsystem subordination in subsystem hierarchy.
1-174 1C:Enterprise 8.3. Developer Guide
Use the Content tab in the subsystem editor to bind metadata objects to a particular
subsystem.
The upper part of the window displays all configuration objects that can be
assigned to individual subsystems. Placing a checkmark next to an object (e.g.,
Contractors on fig. 63) means that this object is included into the subsystem and
is displayed in the lower part of the window. You can see all objects belonging to
the subsystem being edited at the bottom of the window.
If the Include in Help Contents property is set, the help contents will include the
branch showing help for the subsystem and all objects included in the subsystem.
If the property is reset, the help contents will not contain such a branch (describing
the subsystem and included objects), but help for the objects included in the
subsystem will be available directly in object forms.
procedures in a common module can be found in sections "Source Text Format
in Program Modules" and "Operators" of the 1C:Enterprise script help.
To edit a common module, click Open in the Module property at the properties
palette of Common Modules object type in the Configuration window. Text of the
common module is opened in the 1C:Enterprise text editor in module text editing
mode.
A common module is a component of the configuration and is stored in the
configuration only.
The Global property defines if the common module exported methods belong to the
global context.
If the Global property is set to True, the common module exported methods are
available as methods of the global context.
If the Global property is set to False, a property is created in the global context
and its name matches the common module name in the metadata. This property
is read-only. Value of this property is the CommonModule object. Through this
object, exported methods of this common module are exposed. Therefore, syntax
for calling a non-global common module method looks like XXXXX.YYYYY where
XXXXX is the property name in the common module context and YYYYY is the
name of the common module exported method.
Example:
TradeEquipmentOperation.PlugInBarcodeReader();
If a common module has its Server property set along with another property,
it means this module is available at the server and the selected client. You should
keep in mind that you would have multiple variants of compiled code (for the
selected clients and the server).
If a method located in this common module is called by the client, it uses the
client copy of the module; if called by the server, it uses the server copy. In this
case you can use preprocessor directives (for details see page 1-159) to "protect"
the server from the code it cannot execute.
Consider the following example. A common module that can run at both the thin
client and the server owns a method which behaves differently depending on where
it is executed: the thin client or the server. Consider how you can handle this:
// Display warning
ShowUserNotification("At client");
#EndIf
EndProcedure
The code on the thin client side looks like the following:
Procedure CommonModuleMethod() Export
// Enter important code here
// Display warning
ShowUserNotification("At client");
EndProcedure
You can use different methods to transfer control from the client to the server:
call methods of the server-side common module;
in the form or command module, call a method preceded by compiler directives
&AtServer, &AtServerNoContext (for details on form modules see page
1-390).
Please note that server procedures do not support calls to methods of client
common module (without their Server property set) or to client methods of form
Chapter 5. Configuration Objects 1-177
and command modules. Control is transferred back to the client after the most
external call to a server method is complete.
This does not apply to form and command module methods preceded by compiler
directives &AtClientAtServer, &AtClientAtServerNoContext (for details see
page 1-390).
Please keep in mind the following points:
While writing code for a common module that is available to multiple clients,
you should consider maximum limits which might be imposed by clients or use
preprocessor instructions to "isolate" client-specific code.
Preprocessor instructions are also useful if a common module has multiple
execution contexts, e.g., an external connection and a thin client or a client and
a server (as is often the case). In this case preprocessor instructions enclose
interactive code that cannot run at the server and can be executed at the client
(see the example above).
For details on preprocessor instructions and compiler directives see page "Use
preprocessor instructions and compiler directives to allow use of procedures and
functions from various modules (for information about module types see page
1-115)." on page 1-177 and section "Execution of Procedures and Functions" in the
1C:Enterprise script help.
To control calls to exported methods of the server-side common module in the
client code, use the Server call property. If this property is set, exported methods of
the server-side common module can be called by the client. If this property is not
set, you can only call exported methods from server-side methods (both methods of
server-side common modules and server methods of form and command modules).
TIP
It is recommended to set the Server call property to False if the server-side com-
mon module contains methods that are not recommended to be called by the client
(e.g., for safety reasons).
NOTE
If the Client (ordinary application), Client (managed application), External connection
properties are set simultaneously, the Server call property is cleared automatically.
If the Server call property is set, the Client (ordinary application), Client (managed
application) and External connection properties are automatically cleared, provided
that they were set simultaneously.
The Privileged property can be used to disable control over access rights when
executing common module methods.
IMPORTANT!
If the Privileged property is set for the common module, its Server property is set
automatically and other properties are cleared (Client (ordinary application), Client
(managed application) and External connection). The privileged common module
can only be executed at the server.
For details on the privileged mode see page 1-181.
1-178 1C:Enterprise 8.3. Developer Guide
This common module property does not affect procedure execution: procedures are
always executed.
If return values reuse is set for a common module, the list of export function
parameter types becomes limited. Parameters can only be of the following types:
Primitive types (Undefined, NULL, Boolean, Number, String, Date);
Any references to database objects;
Structures with property values of the above types. In this case parameter iden-
tity is controlled based on structure content.
If the Reuse return values property is set to During session in the common
module, values returned by functions of this module can't use TempTablesManager
type values.
Where the function of a common module with the reuse option selected is called
from the same common module (e.g. named CommonModule), it should be remem-
bered that if the function is called by the MyFunction() name, the function will
be executed every time the function is called. To make use of saved values, the
function should be called by its full name: CommonModule.MyFunction().
RefreshValuesReuse() global context method removes all reused values both
at the server side and at the client side, regardless of the method call location.
After the RefreshValuesReuse() method is executed, the first function call
is executed afresh.
Session parameters are typed. A list of session parameter types is limited. Their
common feature is inability to modify the inner state for objects of these types.
To set or get a value for a session parameter, the current user should have
sufficient rights.
In the client/server mode, session parameter values are stored at the
1C:Enterprise server and are available from both the server and the client.
Session parameters are available both in the 1C:Enterprise script, for example:
SessionParameters.CurrentUser = UserName()
In the latter case getting a session parameter value does not require the current user
to have corresponding rights.
NOTE
If one of the following types is set for the session parameter: FixedArray,
FixedCollection or FixedStructure, the Undefined value can be used as
a collection element value.
If the View right is set (granted) for an object with data in a form, but the Edit
right is not set, this attribute is displayed in the form (with the attribute value
displayed in the control associated with this object), but the value is unavailable
for editing. If the View right is removed (withdrawn), an attempt to open the form
displays an "Access violation!" warning, and the form fails to open.
When editing roles, note the internal right hierarchy in the list of rights. The hier-
archy is based on the precedence of the rights. When any right is removed,
every lower-level right associated with it is also removed and, conversely,
when a lower-level right is set, any higher-level rights removed are also set. So
removing the View right causes the Edit right to be removed. This is quite reason-
able since it does not make sense to grant an edit right when a control associated
with the data cannot be shown.
Generally, rights can be granted for:
the entire configuration
objects
object attributes
tabular sections
tabular section attributes
standard attributes
When a new role is created, the following access rights are set for the configura-
tion root object: ThinClient, WebClient, UserDataStorage and Output.
The PrivilegedMode() function returns True if the mode is on and False if
it is completely off. It does not count how many times the privileged mode has
been enabled in a particular function.
You might need to set the privileged mode programmatically if you perform mass
operations with infobase data and do not need to check data access rights. Assume
a user is responsible for recalculation of product prices. In this case the data
processor that performs this operation can check the right of the current user to run
it, and then the privileged mode can be enabled to perform all the required actions
in the database. The user might have no rights to view the prices. However, since
this data processor only recalculates the prices without showing them to the user,
the task of access restriction is also performed.
You can also start a privileged session. In this session, a privileged mode is set
from the very start of work. During operation, mode PrivilegedMode() will
always return True, and disabling the privileged mode is not supported. To start
a privileged mode, the user shall be assigned administrative rights (Administra-
tion rights). To launch a session, use the UsePrivilegedMode key of the client
application launch command line, or the prmod parameter of the line used to
connect to an infobase.
□□ SplitFile()
□□ CreateDirectory()
□□ DeleteFiles()
□□ New File
□□ New xBase
□□ HTMLWriter.OpenFile()
□□ HTMLReader.OpenFile()
□□ XMLReader.OpenFile()
□□ XMLWriter.OpenFile()
□□ FastInfosetReader.OpenFile()
□□ FastInfosetWriter.OpenFile()
□□ XMLCanonicalizingWriter.OpenFile()
□□ XSLTransform.LoadFromFile()
□□ ZipFileWriter.Open()
□□ ZipFileReader.Open()
□□ New TextReader()
□□ New TextWriter()
□□ New Picture(), if the first parameter is a string
□□ Picture.Write()
□□ New BinaryData()
□□ BinaryData.Write()
□□ FormattedDocument.Write()
□□ GeographicalSchema.Read()
□□ GeographicalSchema.Write()
□□ GeographicalSchema.Print()
□□ SpreadsheetDocument.Read()
□□ SpreadsheetDocument.Write()
□□ SpreadsheetDocument.Print()
□□ GraphicalSchema.Read()
□□ GraphicalSchema.Write()
□□ GraphicalSchema.Print()
□□ TextDocument.Read()
□□ TextDocument.Write()
○○ Internet access:
□□ New InternetConnection
□□ New InternetMail
□□ New InternetProxy
□□ New HTTPConnection
□□ New FTPConnection
1-184 1C:Enterprise 8.3. Developer Guide
IMPORTANT!
When forbidden operations are performed at run time, an exception is raised.
NOTE
External reports and data processors opened using File – Open are executed in the
safe mode if the user has no administrative access rights.
The safe mode should be enabled as many times as it is disabled. However, if the
safe mode was enabled within a procedure or a function (once or multiple times)
and was not later disabled, the system disables it automatically as many times as
it was enabled in the procedure or function without being disabled.
If a procedure or function calls the SetSafeMode(False) method more often than
it calls the SetSafeMode(True)method, an exception is raised.
The configuration developer might need to set the safe mode programmatically
if he or she intends to use code that is external relative to the configuration and
is not absolutely reliable. An example would be execution of Execute() and
Evaluate() methods when executable code comes from outside the system.
In this case setting the safe mode before executing these methods would be a good
practice.
// The code to be executed is generated
// The code could be loaded from external sources
// or entered manually
ExecutableCode = GetExecutableCodeFromOutside();
specialists debugging the configuration can use system operation without reference
integrity control. If reference integrity control is not used, objects are deleted
directly (without deletion marks) and unresolved references can appear.
The most radical method of setting the reference integrity control mode is fully
disabling the right to directly delete entire objects. This method prevents any
direct deletion of objects within a given configuration. Users are only able to mark
objects for deletion.
Please note that you can directly delete objects using the 1C:Enterprise script tools.
Therefore, items of a specific configuration can directly delete objects bypassing
reference integrity control. In this case a specialist who configures the system
is responsible for data integrity.
When a new role is created, the Designer sets the following for all rights:
rights are not granted for objects.
rights are granted for attributes (including standard attributes) and tabular
sections (including standard tabular sections).
The Independent rights of subordinate objects checkbox defines how the system
considers the parent object rights when it determines the rights for a subordinate
object. If the checkbox is checked, parent object rights are not considered. If the
checkbox is reset, the corresponding parent object right is analyzed to determine any
subordinate object rights. If the parent object does not have the right, the subordinate
object will also not have the right, regardless of the subordinate object right state.
Even if Independent rights of subordinate objects is selected, the right to a subor-
dinate object requires that the same right be held to the parent one. That means
that an attribute or a tabular part requires the right to an object, while the tabular
part attribute requires the right to a tabular part or an object. This property matters
if a user is assigned several roles with rights added via "OR". That means that
if a role has the Independent rights of subordinate objects property set, and there
is only a right to an attribute, while another role has the right to an object only, the
user will have the right to an attribute only when the rights of these roles are added.
When setting attribute (tabular sections) access rights for reports/processes, please
note the following: if the Independent rights of subordinate objects checkbox
is unchecked and the Edit right is set for the attribute (tabular section), and the
View right is not set for the report/processes, it will be assumed that the Edit right
is also not set for the attribute (tabular section).
Chapter 5. Configuration Objects 1-187
If multiple roles are assigned to a user, the parent object rights are validated before
rights per role are combined (see page 1-185).
The Independent rights of subordinate objects check box affects the following
objects:
attributes (including standard attributes)
tabular sections (including standard tabular sections)
tabular section attributes (including standard tabular section attributes)
commands
To change an access right, select a configuration object in the left-hand list and
select or cleat the check box for the required action in the right-hand list. If you
need to modify access to all objects in a branch, select it in the left-hand window
and make the required changes in the access rights.
A description of each role can be displayed in a spreadsheet or text document using
Actions – Output list.
The window contains three table boxes. The first (leftmost) field is used to select
the required configuration object. The first column of the second table box contains
a list of rights for the selected object. The other columns are used to specify use of
each right for every existing role.
1-188 1C:Enterprise 8.3. Developer Guide
To set or remove all the rights for any role, select or clear the permission check box
in the first row of the table box.
To set or remove all permissions for a certain right in all the roles, select or clear
the permission check box in the first row of the table box.
You are allowed to move columns corresponding to roles.
The third table box is used to edit data access conditions at the level of separate
fields and records.
documents
document journals
charts of characteristic types
charts of accounts
charts of calculation types
information registers
business processes
tasks
IMPORTANT!
If you call database object fields from the 1C:Enterprise script using application
object properties, it reads the entire object rather than the value of the used field.
The only exception is retrieving a presentation when field values are only read
if they are a part of this presentation.
Access restrictions are stored in roles, can be assigned to most metadata objects
and written in a special language that represents a subset of the query language.
On the other hand, a description in the data access restriction query language
looks as follows:
<Query description>
[Main limitation target table alias]
[FROM <Source list>]
[WHERE <Filter condition>]
1-190 1C:Enterprise 8.3. Developer Guide
For a description of a list of sources, see page 1-453. For a description of filter
conditions, see page 1-460. Please note that embedded queries used in the data
access restriction language have a limited set of available functions (see page
1-191);
Session parameters (see page 1-192) and functional options (see page 1-192)
can be specified as condition items;
Templates that simplify a description of restrictions (see page 1-197) may
be used in any part of a data access limitation query.
The main component of such a restriction is a condition calculated for each
entry of the database table to which a data access restriction is applied. An entry
is available if a non-empty table is received when a condition is applied to one
table entry of the main restriction target (i.e. a table that contains one or more
entries). If an empty table is received when a condition is applied, the entry to
which the condition was applied is unavailable. The user can change a table entry
for the main restriction target, if such an entry does not contradict the restriction set
for the right – both before the change operation, and after it.
Table fields
The following can be used in data access limitations:
Table fields of an object, for which data access limitations are described.
For example, if a restriction is applied to reading items of the Contractors
catalog, it can use fields of the Contractors catalog and its tabular sections.
Thus, the simplest restriction applied to reading items of the Contractors
catalog can look like the following:
WHERE Description = "Brickworks"
Or:
WHERE Goods.Description = "Red brick"
Or:
WHERE ChiefManager.Person.Description = "Petrovsky"
For example, you can apply the following restriction to reading items of the
Contractors catalog:
Contractors
FROM
Catalog.Contractors AS Contractors
LEFT JOIN Catalog.Users AS Users
BY Contractors.ChiefManager.Description = Users.Description
WHERE Users.Person.Description = "Petrovsky"
This restriction uses fields of Users catalog items associated with an item
in the Contractors catalog by the value of the Description fields.
Nested queries
Nested queries are used to create a set of entries to be used:
to connect to a table of the main restriction target;
as a comparison operand IN or NOT IN.
Nested queries may use any query language tools except for the following:
IN HIERARCHY operator;
TOTALS statement;
Results of nested queries will not contain any tabular sections;
Some virtual tables, including BalanceAndTurnovers.
The next example of a restriction applied to reading the Contractors catalog
uses a nested query as a set of records for association with the main object of
restriction:
Contractors
FROM
Catalog.Contractors AS Contractors
LEFT JOIN
SELECT
Users.Description, Users.Person
FROM
Catalog.Users AS Users
WHERE
Users.Code > "Petechkin") AS Users
BY Contractors.ChiefManager.Description = Users.Description
WHERE Users.Person.Description = "Petrovsky"
Employees.Person AS Person
FROM
InformationRegister.Employees AS Employees)
If you want to retrieve data from a tabular section in the nested query, you
should call this tabular section directly in the FROM section of the nested query.
For example, rather than using the following:
SELECT
Ref AS Ref,
Goods.Description AS GoodsDescription
FROM Catalog.Contractors
as a query nested in the restriction, you should use the following:
SELECT
Ref AS Ref,
Description AS GoodsDescription
FROM Catalog.Contractors.Goods
Session parameters
Data access restriction queries may include session parameters. For example, you
can apply the following restriction to reading items of the EmailMessageGroups
catalog:
Functional options
Data access restriction queries may include functional options. You are only
allowed to use functional options that are independent of parameters. For example,
if the Nomenclature catalog has a MainWarehouse attribute, a restriction
applied to reading this attribute might look like the following:
WHERE &AccountingByWarehouse = TRUE
Usage features
Restrictions applied to database objects of the following types can only use some
fields of the main data object of restriction:
Accumulation registers can contain dimensions of the main restriction object
only.
Accounting registers within restrictions can use balance dimensions of the
main restriction object only.
Chapter 5. Configuration Objects 1-193
NOTE
If turnover register data access restrictions use dimensions that are not part of the
totals, then the stored totals will not be used when you are accessing the virtual
turnover table, and the request will be based on the record table only.
Example:
SELECT
ContactInformationSliceFirst.Presentation
FROM InformationRegister.ContactInformation.SliceLast(, Type = &Type)
AS ContactInformationSliceFirst
WHERE
ContactInformationSliceFirst.Type = &Type
If an object-oriented approach is used, getting access to data in the ALLOWED mode
is not supported. Object techniques are intended for critical operations on data
including data modification. To retrieve data using object techniques, regardless of
the restrictions set, you should perform the required actions in a privileged module
or as a user with full access rights. There are no methods of retrieving allowed data
only within the object techniques.
Mechanism of Applying Restrictions
In 1C:Enterprise any operation with data stored in the database eventually calls
the database requesting to read or modify data. When queries to the database
are executed, 1C:Enterprise internal mechanisms restrict access. The following
is performed:
A list of rights (read, insert, update, delete), database tables and fields used
in the query is generated.
Data access restrictions applied to all rights, tables and fields used in the query
are selected in all roles of the current user. If any of the roles has no data access
restrictions applied to a table or field, it means values of the required fields
are available in any record of the table. In other words, when no data access
restrictions are applied, it means the WHERE True restriction.
Current values of all session parameters and functional options that contribute
to the selected restrictions are obtained.
To obtain a session parameter value from the current user, you do not need to have
the right to obtain this value. However, if any session parameter value has not been
set, an error will occur, and a database query will not be executed.
Obtaining functional options depends on the way in which the Privileged mode for
obtaining property of the functional option is set (see page 1-211). If the property
is reset, the current user will possess read rights for the object where the functional
option is stored.
Restrictions retrieved from a single role are grouped using AND.
Restrictions retrieved from different roles are grouped using OR.
Generated conditions are added to SQL queries used by 1C:Enterprise to
call the DBMS. When data are retrieved (from metadata objects or database
objects), access restriction conditions do not validate rights. The mechanism
of adding conditions depends on the selected approach to applying restrictions:
All or Allowed.
Chapter 5. Configuration Objects 1-195
"All" Approach
If restrictions are applied using the "All" approach, conditions and fields are added
to SQL queries so that 1C:Enterprise could obtain information on any data in the
database query even though it is not allowed for the current user. If restricted data
are used, the query fails. An outline of applying restrictions with the help of the
"All" approach is shown on fig. 66:
"Allowed" Approach
If restrictions are applied using the Allowed approach, conditions are added to
SQL queries so that records unavailable to the current user have no impact on the
query result. In other words, if restrictions are applied using the Allowed approach,
records unavailable to the current user are considered missing. An outline of this
approach is represented on fig. 67:
Session Parameters
You can use session parameters in data access restrictions in the same way you
use query parameters in queries.
Functional Options
You can use functional options that are independent of parameters in data access
restrictions in the same way you use query parameters in queries.
Privileged Common Modules
If a common module has its Privileged flag set, execution of procedures and func-
tions in this module takes on important characteristics:
In 1C:Enterprise client/server mode a privileged module runs at the server only.
When procedures and functions of a privileged module or any objects they call
are executed, the rights restriction system is disabled (both for metadata objects
and for data). Therefore, in the privileged module, you can perform any opera-
tion on any objects even if the current user is not granted the required rights.
Privileged modules are used to set initial values of session parameters used in data
access restrictions. Additionally common modules allow users with restricted rights
to perform consistent actions with data. For example, if the user is responsible for
entering and posting documents, but should have no access to data impacted by
document posting, the posting operation can be transferred to a privileged module.
In this case the user can post documents without being granted rights to any other
data (e.g., registers).
Privileged Mode
When working with data, you can set the privileged mode programmatically.
You might need to set the privileged mode programmatically if you perform
mass operations with infobase data and do not need to check data access rights.
For a description of the privileged mode see page 1-181.
Using preprocessors
Preprocessor instructions can be used when editing data access restriction text.
The following instructions are available:
<Expression> – is an arbitrary logical expression in the script with a Boolean
type result. The expression may contain the following:
Comparison operations <, >, <=, >= , =, <>.
Chapter 5. Configuration Objects 1-197
Example:
#IF &CurrentUser <> "Klimova" #THEN
<access limitation text>
#ENDIF
restrictions set for the Test catalog. Restrictions are applied as "OR", i.e., all
records available by at least one condition will be available. If conditions are
not set for some of the fields, the query will be run for all table records.
If the query uses a top-level table, any restrictions set for nested tables columns
are not applied.
If the query uses a nested table, all restrictions are applied both for the nested
table and the top-level table. For example, the SELECT QUANTITY (*) FROM
Catalog.Contractors.Agreements query will be run with all the restric-
tions for the Contractors catalog and all the restrictions for the Agreements
tabular section.
If access to the fields required to get a metadata reference object's representa-
tion is disabled using data access restrictions or object access is disabled at the
access rights level, then getting the object's representation will not affect the
current transaction.
The Links tab enables you to specify the criteria for the links between the fields of
the tables. Click Add to enter a new condition and select one of the tables from the
Table1 column. Select another table with fields linked to the fields of the first table
from the Table2 column. Controls that are used to create table link conditions are
located below the criteria list.
If a simple type of condition is selected, choose the linked fields of the tables
in Field1 and Field2 and set the comparison condition. If the selected fields are not
compared, the condition list line will display the following error message in the
Link condition column: Incorrectly completed condition.
Specify conditions for source data filtering at the Conditions tab.
For each selected field, choose the type of condition and specify the parameter
name. You can use a session parameter as the parameter. You can specify multiple
conditions. In this case the Condition column of the table box displays the condi-
tion text in multiple rows.
You can view the query text anytime while generating the query by clicking the
Query button.
1-202 1C:Enterprise 8.3. Developer Guide
This mode can be used to view all the entered access restrictions in a single list (by
all roles, objects, rights and field combinations).
You are allowed to add access restrictions for multiple roles, objects, rights and
field combinations.
You can also filter the lost using different criteria.
In the batch editing mode you can remove the restrictions marked in the list.
You can also edit the selected restrictions. While doing so, you can replace a set of
fields and/or access restrictions.
Chapter 5. Configuration Objects 1-203
Additionally the batch editing mode can be used to copy the selected restrictions to
other roles.
The Restriction Templates tab shows all access restriction templates that are
included in the application. But only the first 10 strings ending with ..., if the
template text contains more than 10 strings, are shown. The template editing
window shows the full template text.
You can add the access restriction template for multiple simultaneous roles.
You can select the templates you need with a set of criteria and according to the
value of the current column.
The editor also allows you to edit selected templates. You are allowed to change
the template name and text if needed.
This will result in a Common attribute configuration object that can be used to
include common attributes in necessary configuration objects.
Common attribute behavior is set with the Data split property. If this property
is set to Do not use, the configuration object created will be used only as an
attribute included in several (or all) of the configuration objects. If the property
is set to Split, the common attribute will use a data separator (see page 2-895).
A list of configuration objects in which a common attribute is included is set
using the Content and Auto-use properties (or in a corresponding tab in the More
window (see page 1-56)).
If the Auto-use property is set to Use, the common attribute created will be auto-
matically added to all existing configuration objects (for which common attributes
can be used) and it will be automatically added to all new configuration objects.
If the Auto-use property is set to Do not use, the attribute will not be added
automatically, and you should use the Content property to select objects in which
common attributes will be included.
The same property should be used when the common attribute is used automati-
cally and there are objects to which the attribute should be added (see fig. 79).
The common attribute content editing window is divided into two parts:
The upper part shows all the configuration objects that can be included in a
common attribute.
The lower part shows objects with non-default settings that are set with the
Auto-use common attribute value:
○○ If the property is set to Use, the lower side will contain a list of objects not
included in the common attribute.
○○ If the property is set to Do not use, the lower side will contain a list of
objects included in the common attribute.
1-206 1C:Enterprise 8.3. Developer Guide
You can edit data both in the upper and lower sides, and the edited configuration
object will be moved between the window sides regardless of the Use column
value.
The Use column can have one of three values for every configuration object:
Automatic – this value means that assigning the configuration object to
a common attribute will depend on the common attribute’s Auto-use property:
○○ The Use value specifies that the configuration object is included in the
common attribute.
○○ The Do not use value specifies that the configuration object is not included
in the common attribute.
Use – this value specifies that the configuration object is included in the
common attribute regardless of the Auto-use property value.
Do not use – this value specifies that the configuration object is not included
in the common attribute regardless of the Auto-use property value.
So you can use the Content property, for example, to selectively exclude some
objects from a common attribute event if autousage is enabled for the attribute.
A common attribute (without the data separation mode) can include the following
configuration objects:
Catalogs
Documents
Document journals
Charts of characteristic types
Chapter 5. Configuration Objects 1-207
Charts of accounts
Charts of calculation types
Business processes
Tasks
Information registers
Accumulation registers
Accounting registers
Calculation registers
Exchange plans
External data sources
When a document is recorded, the log’s common attribute gets the value of the
document’s common attribute or NULL if the document is not a part of the common
attribute.
A common attribute can be used in data access restrictions (see page 1-188).
It is a good idea to add external data sources to the common attribute only if the
common attribute is a separator (see page 2-895). Detailed information on how to
use an external data source that is part of the separator can be found in the section
on this (see page 2-871).
A common attribute can be composite.
TIP
Do not use common attributes to describe data that is related to specific object
business logic.
Common attributes are shown in the form editor when you edit common attribute
object forms, and they can be placed on a form.
5.5.7. Filter
Filter criterion objects are components of the information filtering mechanism.
A system configuration specialist uses them to create predefined filtering rules.
In the 1C:Enterprise mode these criteria will be used for filtering information from
lists.
Specify the name, synonym and comment in the Filter criterion object editing
window.
Filter criteria may be of any standard type or of any type defined as configuration
tree object. You can include composite-type attributes such as CatalogRef, Docu-
mentRef, etc. and composite-type attributes with a defined chart of characteristic
types (Characteristic…).
Specify the types for filtering when you create a type of filter criteria. The Content
tab for this type will contain a list of configuration objects containing data of the
type that is included in the filter criteria type. Check the attributes that will be
used as a filter.
For the criteria to perform their functions, create a list of attributes of catalogs and
documents in the Designer (Content tab). There are virtually no limits imposed
on the contents of the list: for example, unlike a journal column, you can select
several attributes of a document or its tabular section for the filter criteria.
There may be any number of filter criteria and each criterion may have more
than one form of displaying results. This procedure can be useful when you
look for various information. For example, you want to filter all documents that
use a certain contractor (in attributes and tabular sections). You can also set
other information filtering criteria (e.g., you can search posted documents only or
a specific date range, etc.).
NOTE
When you open a filter form, the Filter parameter with the filter value set (the
Value element) will be transferred to it. For more details on the form parameters,
see page 1-384.
Filter criterion may have any number of forms for displaying results. For quick
retrieval of filtered information you can place the form call in the user menu or on
the toolbar.
If there are multiple filter criteria forms, specify the default form in the Default
Form property.
If the configuration has multiple subsystems, select the subsystem where the crite-
rion belongs. You can specify several different subsystems.
To call a filter criteria form, the system places the corresponding command in the
form navigation panel.
Chapter 5. Configuration Objects 1-209
You can also assign event handlers by using the 1C:Enterprise script. Use the
AddHandler and DeleteHandler operators for these purposes.
Objects that can become sources of events have the AdditionalProperties prop-
erty of the Structure type. This property can store information between event
calls, e.g., information on whether the object is new or old.
In the client/server mode you can use the administration utility to disable automatic
execution of scheduled jobs for a particular infobase.
Form
Functional options can affect form attributes and commands, as a consequence,
changing visibility of associated form elements (fields and columns for form attrib-
utes and buttons for form commands). Please take note of the following system
behavior features when developing a form:
The form attribute of the reference type will be disabled if the functional option
disables the configuration object forming this type. The complex type form
attribute will be disabled if the functional options disable all complex types.
The <Type>Object form attribute (e.g., the main form attribute) will be disa-
bled if the functional option disables the configuration object forming this type.
The form table will be disabled if it displays the data of a form attribute disa-
bled by a functional option.
Types are not available in the type selection dialog (e.g. for text boxes linked
with complex type attributes) if the functional option disables configuration
objects forming this type. Information regarding the types disabled by func-
tional options is cashed on the client side and cleared in 20 minutes or when
the RefreshInterface() method is called.
IMPORTANT!
Unlike the command interface, parameter values of functional options are set for
a specific form instance only.
Characteristics
Functional options affect the visibility of form fields that display object char-
acteristic values. To make such changes, you need to add an attribute with
a characteristic value to a functional option.
Consider the following example. Characteristics are used for the Products catalog,
characteristic types are stored in the plan as Characteristics and their values
are stored as a CharacteristicValues information register resource. A resource
is included in the CharacteristicsAccounting functional option.
1-214 1C:Enterprise 8.3. Developer Guide
catalog
document
journal
chart of accounts
chart of characteristic types
chart of calculation types
business process
task
exchange plans
report
data processor
accumulation register
information register
accounting register
calculation register
command
metadata object attribute
tabular section
tabular section attribute
accounting flag
extra dimension accounting flag
addressing attributes
register dimension
register resource
Functional options can also affect visibility of form elements.
5.5.10.5. Creation
Creation of Functional Options
To create a functional option, you need to create a Functional option configuration
object. You can do it the usual way in the Designer mode, i.e. select Common –
Functional options in the configuration window and add a new object (see fig. 83).
It will result in a Functional option configuration object that can be used to assign
functional options to other metadata objects (see fig. 84).
In addition to the name field, the object has another required field – Location.
In the editor you can select one of the objects that will serve as a source for the
option value. The list of available objects includes:
Constants
Catalog attributes
Information register resources
Chapter 5. Configuration Objects 1-217
The source of the option value can be any type, without restriction; however, for
interface management purposes you can only use functional options that store their
values in attributes of the Boolean type. Functional option values of other types
are only available for analysis in the 1C:Enterprise script.
The PrivilegedGetMode property specifies how the functional option value
is received (and cached).
Fig. 85. Privileged mode when getting the functional option value
1-218 1C:Enterprise 8.3. Developer Guide
5.5.10.6. Use
Assignment to Metadata Objects
A metadata object (e.g., a catalog) can be assigned to one or more functional
options. To do so, you can use the Functional options property that stores references
to the functional options created in the configuration (see fig. 86).
The list of available options is limited to the options that have an object of
Boolean type in their Location property.
IMPORTANT!
If an object is not assigned any functional options, it is always visible. Otherwise
the object is visible if at least one of its assigned functional options is enabled
(i.e. functional options are grouped by OR).
Chapter 5. Configuration Objects 1-219
You can do so in the form editor by setting the Functional options property for the
required object.
1-220 1C:Enterprise 8.3. Developer Guide
The state of functional options affects visibility of form objects in the same way
it affects metadata objects. For example, if a command is disabled using a func-
tional option, all associated buttons are hidden.
If a form attribute or command has no functional options assigned, it is always
visible. Otherwise the form attribute or command is visible if at least one of its
assigned functional options is enabled.
Use in Data Access Restriction
You can use Functional options within data access restrictions (see page 1-188)
in the same way as Session parameters (see page 1-179). You are only allowed to
use options that are independent of parameters, i.e. are bound to constants.
IMPORTANT!
The system checks name uniqueness for session parameters and functional
options.
When using parameterized functional options, you should keep in mind the
following:
In list forms an attribute column associated with the parameterized functional
option is displayed if the infobase stores and least one enabled value for this
functional option.
If you want all attributes associated with functional options to be disabled by
default when you open a form, you should set values of these parameters to
those missing in the infobase (an empty reference for catalogs or values of
dimensions with no records for information registers). In this case the func-
tional option is set to False.
If a reference to a group (if the type of a functional option parameter allows
group creation) instead of a reference to an element is specified as the param-
eter, the system will behave as follows:
○○ If an attribute that stores a functional option value is used both for the
element and the group, the value of the functional option will be defined by
the value of this attribute.
○○ If an attribute that stores a functional option value is not used for a group,
NULL is returned when a functional option value is obtained with the
following methods: GetFunctionalOption(), GetFormFunctionalOp-
tion(), and GetInterfaceFunctionalOption(). If a functional option
that has been parametrized impacts the user interface, the system will
perceive it as disabled (the functional option will be set to False).
You can set a snap to a parameterized functional option for metadata objects
used as a basis for commands. Commands for these objects are only displayed
in the command interface if there is at least one combination of functional
option parameters that makes the functional option value True. However,
you can use the SetInterfaceFunctionalOptionParameters() method
to set specific parameter values for functional options. In this case command
visibility is defined by the parameters you specify.
A dynamic list automatically uses functional options used by the form. If the
attributes used in the dynamic list query are disabled for the specified combi-
nation of functional option parameters, the corresponding data are not selected
and displayed in the dynamic list and the attribute is removed from the lists
of available attributes in the Dynamic List Data Display Settings dialog box
(in 1C:Enterprise mode).
Forms have their own method that returns an option value for parameters specified
within a particular form – GetFormFunctionalOption().
If a functional option value changes in the database, the global command interface
and currently open forms are not automatically updated.
To update the global command interface, you should explicitly call SetIn-
terfaceFunctionalOptionParameters(). The command interface is updated
with regard to the new state of the functional options.
NOTE
If a functional option value changes in the database, the global command inter-
face and any currently open forms are not automatically updated. You should use
the RefreshInterface() method after writing the functional option values to
the database.
Note that setting functional options parameters (and running the RefreshIn-
terface() method) have the following consequences:
For every form closing of all auxiliary forms is called (and the corresponding
handlers are called).
Forms that are denied closing are not closed.
Main form elements are refreshed.
If the main form was active at the moment of interface refresh, the main form
is shown with new elements.
If an auxiliary form was active at the moment of interface refresh, then:
○○ the open auxiliary form command will be executed, if this is available when
the interface is refreshed.
○○ otherwise, the main form elements are refreshed and the form is displayed.
If an auxiliary form opened with a command that is not related to the form
navigation panel was active at the moment of interface refresh, the main form
elements will be updated instead and the main form will be shown.
To refresh a specific form you should reopen the form or call the SetFormFunc-
tionalOptionParameters() method. The steps above will work only for the
form, in the context of which form setting the functional option parameters was
initiated.
You do not need to specify all parameters at once; you can change a value for
a specific parameter or a set of parameters. However, setting a group of values
in a single call is more efficient.
To retrieve parameter values, you should call an appropriate function
(GetInterfaceFunctionalOptionParameters() or GetFormFunctionalOp-
tionParameters()) that returns the specified parameters as a structure with the
parameter name used as a key.
When opened, the form automatically uses parameters of the functional options set
for the command interface.
Chapter 5. Configuration Objects 1-223
Forms should use the passed parameters and filter the settings list appropriately.
Thus, you should only display the settings for the setup object (e.g. a report) speci-
fied in the ObjectKey parameter.
If you select a setting, the result of the form activities should be a value of the
SettingsSelection type. The SettingsKey of this value must contain a key for
the selecting setting (e.g., a catalog item code or another parameter that identifies
the setting), while the AdditionalProperties property should store additional
information possibly specified in the form by the user:
Close(New SettingsSelection(SavedSettingKey));
IMPORTANT!
A setting cannot be saved in the standard settings storage if the object key length
exceeds 256 characters or the settings key is more than 128 characters long, or
the user name has more than 64 characters.
TIP
If you significantly change settings programmatically (for example, when you
copy the settings of one user to another user), it is recommended to prompt the
users to restart the client application.
settings read/write operations will fail. To solve this issue, implement Save-
Processing and LoadProcessing event handlers in the module of the newly
created ValueStorage object.
6. The objects selected at step 2 (or in the configuration properties) have their
properties filled in, thus indicating what storages will be used to save the
settings. In this example you need to fill in the Form data settings storage
configuration property with a reference to the object created at step 4.
7. Events handlers associated with saving and restoring settings in application
objects are implemented, if necessary.
Procedure CopySettings(ListOfUsers)
SettingsDescription.Presentation = SettingsSelection.Presentation;
SettingsStorage.Save(SettingsSelection.ObjectKey,
SettingsSelection.SettingsKey, SettingsSelection.Settings, SettingsDescription, User);
EndDo;
EndDo;
EndProcedure
The command opening a common form will be included in the command inter-
face of the subsystems that own the common form.
If a common form is included in a functional option and the option is disabled,
the common form standard command will not be shown in the command interface.
If you create a common form that will be used as a report form, a report or variant
settings, setting the Use standard commands property for this form is not recom-
mended.
To add a new picture, press the Add button. A new window will open, where you
can select a picture from a file or open the picture editor and create a new picture.
You can also use this window to select or change the transparent background for
a picture. To select an existing picture, press the Select from file button and select
the file containing the existing picture. In the 1C:Enterprise system, you can use
BMP, GIF, JPEG, PNG and TIFF picture formats, as well as icons and metafiles
(WMF, EMF).
TIP
For pictures used as interface icons (for the recommended picture sizes, see the
beginning of the section), it is recommended to use formats that support lossless
compression (PNG and GIF), prevent distortion and minimize client/server traffic.
Specify the name that will be used to select this picture by means of the
1C:Enterprise script.
1-232 1C:Enterprise 8.3. Developer Guide
Click the Edit button to edit the picture. The picture editor will open (for details see
page 2-1012).
Once the required .xsd file has been specified, the availability of the XDTO pack-
ages must be checked in the configuration tree, with the namespaces matching
those imported from the file. If these packages are available, a list will be displayed
and you will be prompted to specify the packages to be updated (the existing pack-
ages are not updated by default).
The import procedure is then executed, resulting in the addition of new XDTO
packages to the configuration tree, while packages specified for update will be
updated.
Once the directory has been selected and the file name specified, the XML schema
is exported to the specified file.
When a new XDTO package is added to the configuration tree, the XDTO
package editing window opens automatically.
To open the editing window for an existing XDTO package, specify the relevant
XDTO package in the configuration tree and execute the Open package command
in the context menu.
XDTO Package Hierarchical Structure
The XDTO package editing window contains the hierarchical tree of the XDTO
package.
The XDTO package ID containing the corresponding namespace URI is located at
the tree's root.
The first hierarchy level can include the following package elements:
Import directives – a list of import directives. An import directive is a reference
to another package containing the types referenced by this package. When you
are using the 1C:Enterprise script to work with this XDTO package, this list
of import directives will be available as a XDTOPackageCollection object
stored in the Dependencies property of the XDTO package;
Value types – a list of XDTO value types stored in the XDTO package.
Object types – a list of XDTO object types stored in the XDTO package.
Properties – a list of XDTO package properties. It represents declarations of
objects/values that can be the root items of XML documents, belonging to the
namespace URI of this XDTO package.
Each XDTO value type is described by the hierarchical structure and can
contain the following items:
○○ Pattern describes one XDTO facet of the Pattern type.
○○ Enumeration describes one XDTO facet of the Enum type.
Each XDTO object type is described by the hierarchical structure which can
contain a set of object properties.
For XDTO value types, the properties palette contains the following properties:
Name – a name of the type for a XDTO value;
Base type – a base type for this type of XDTO value;
Variant – a simple type variant (primitive type, list, union). If a value is set,
it has to match the Item Type and Union Types values;
Item type – a list item type in cases where the XDTO value type is defined by
the list. All facets and Types of Subordinates must be null;
Merger types – a list of types making up a union, in cases where the XDTO
value type is defined by a union. Only XDTO value types can become unions.
All facets and the Item Type property must be null;
Length – the length facet;
Minimum length – minimum length facet;
Maximum length – maximum length facet;
Space characters – white space facet;
Minimum including border – facet of the minimum, including limit;
Minimum excluding border – facet of the minimum, excluding limit;
Maximum including border – facet of the maximum, including limit;
Maximum excluding border – facet of the maximum, excluding limit;
Total digit number – facet of the total number of digits;
Number of fraction digits – facet of the number of fraction digits.
For XDTO object types, the properties palette contains the following properties:
Name – a name of the XDTO object type.
Base type – a base type for this XDTO object type. It can only be an XDTO
object type.
Chapter 5. Configuration Objects 1-239
Open – this flag specifies if the XDTO object type is open. This property indi-
cates whether the XDTO object instance can contain additional properties not
defined in its type.
Abstract – this flag specifies if the XDTO object type is abstract.
Mixed – this property indicates whether the corresponding XDTO object
contains mixed contents. If the Mixed property is set to True, then the
Sequenced value will always be True, because mixed contents cannot be
modeled without using an XDTO sequence.
Ordered – this flag specifies if the order of items that represent property
values strictly corresponds to the order of properties in the XDTO object type.
If the Ordered property is set to False, then the input sequence order of XML
elements is not controlled and the output is defined by the sequence order
of properties, provided that the value of the Sequenced property is not True.
Sequenced – this property shows if an instance of the relevant XDTO object
contains an XDTO sequence. This flag has the True value in those cases
where the sequence order of the nested XML elements cannot be unequivo-
cally defined by the sequence order of the properties in the type or the relevant
XDTO object has mixed contents. Use the XDTO sequence to expressly set
the order of items in the way they are represented in the XML document.
The order of the nested items corresponds to the order of properties for objects
of the types, for which the Sequenced property is set to False.
For XDTO object types, the properties palette contains the following properties:
Name – a property name. Property names should be unique within a single
XDTO object type;
1-240 1C:Enterprise 8.3. Developer Guide
Type – a property type. It can be both a XDTO value type and XDTO object
type;
Minimum number – a minimal number of property values. The minimal number
of property values can take values >= 0. Naturally, the Minimum number value
must be less than or equal to the Maximum number value (provided that the
Maximum number is not equal to -1);
Maximum number – properties of the XDTO object type can be defined as
containing single or multiple values. A property is considered to contain
a single value if the Maximum number property is equal to 1. If the value of the
Maximum number property is greater than 1, it is considered that this property
can contain multiple values. These properties are modeled as lists in the object
structure. The Maximum number property shows the maximum number of
property values. Maximum number > 1 can be set only for properties represented
in XML element form;
Can be empty – indicates whether the property can take an Undefined value.
The Can be empty property equal to True can be defined only for properties
with the Item form of representation. If Maximum number > 1, an Undefined
value is allowed for the property values list item;
Fixed – specifies if the property value is fixed. If this is set to True, the fixed
value itself can be obtained through the Default property;
Default – a default property value. The default value type can only be a XDTO
value type. In terms of types, this value must be compatible with the property
type (i.e. be of the same type as the property or of the inherited type). If a single
value is allowed for the property when an XDTO object is created, it takes the
default value. For properties with multiple values, a list of values is initially
empty, irrespective of the fact that the default value is defined;
Form – is the form of property presentation in XML. It can be Text, Item
or Attribute. If the form of presentation is Attribute or Text, the value of the
Maximum number property cannot exceed 1. If the property has the Text value,
then the value of the Minimum number property will also be equal to 1. Only
one property of a separate type can have its form of presentation set to Text,
while all other properties must have their form of presentation set to Attribute;
Local name – a local name used for property presentation. For properties with
the Text presentation form it is an empty string.
Global Property
Properties of a global property are edited in the properties palette (see fig. 102).
The properties palette for a global property contains the following properties:
Name – a global property name. Global property names should be unique
within a single XDTO object type.
Reference – a reference to a root definition of a package property.
Type – a global property type.
Chapter 5. Configuration Objects 1-241
5.5.19. Web-services
The Web service mechanism allows to use 1C:Enterprise as a set of services
in complex distributed and heterogeneous systems, as well as integrate it with
other industrial systems using the service-oriented architecture.
For details on how to use the Web service mechanism see page 2-819.
XDTO packages – a list of XDTO packages with the types that can be used as
returned value types for operations and parameter types of Web service opera-
tions;
Publishing file name – a name of the Web service description file located at
the Web server (for details on Web service publication see "1C:Enterprise 8.3.
Administrator Guide").
To get access to a web service, you need to use the address in the following
format: <Web server host name>/<Virtual directory name>/ws/<Web service name>
or <Web server host name>/<Virtual directory name>/ws/<Web service address>.
So if a virtual directory is named DemoWS, the web service is named DemoOper-
ationWS in the Designer while the address is DemoWorkWS, and this web service
can be accessed using two addresses simultaneously (from a local machine): http://
localhost/DemoWS/ws/DemoOperationWS or http://localhost/DemoWS/ws/DemoWorkWS.
The tab also contains the Module button that opens a Web service module for
editing.
Additionally each operation can contain a set of parameters with names corre-
sponding to the names of the procedure parameters describing this operation.
Chapter 5. Configuration Objects 1-243
Return value type – a value type returned by the Web service operation. It can be
an XDTO value type or XDTO object type.
Value can be blank – indicates whether the returned value can have an undefined
value.
In transactioned – indicates whether or not the code of the Web service module
will be executed in the transaction. If the property is set, the transaction will start
automatically when the Web service is called and upon completion, the transac-
tion will be either submitted or rolled back (depending on the results of execution).
If the property is not set, the transaction is not started when Web service module
execution starts.
Method name – a name of the Web service module procedure that will be executed
when this property is called.
Transfer direction – defines the direction of data transfer using this parameter.
Available values:
Input – means that the parameter can be used for data transfer to the Web service
only;
Output – means that the parameter can be used for both transfer and retrieval of
data to/from the Web service.
5.5.20. WS-references
1C:Enterprise can use third-party Web services by using static references created
in the configuration tree.
You should type the URL of the added Web service description in the opened
window, e.g. http://users.v8.1c.ru/ws/products.1cws?wsdl.
NOTE
When you add a WS reference, note that 1С:Enterprise deletes the final char-
acter "/" from the URL entered. 1С:Enterprise therefore considers the URL
http://localhost/ws/ws-service/?wsdl and the URL http://localhost/ws/ws-service?wsdl
to be identical.
You can view data model structure and properties in the same way as you view
XDTO packages (see page 1-236); however, you cannot edit properties of packages
displayed in the WS reference viewing window.
You can view WS reference structure in the same way as you view Web services;
however, each Web service has a list of supported connection points that also have
a list of operations and their parameters.
Using different Web service connection points allows you to run operations using
different protocols.
Font
Border
NOTE
System style items cannot be selected as values of custom style items.
The font selection dialog box used at the thin client contains a list of fonts that
includes fonts installed at the machine and special fonts enclosed in angle brackets
(<>). If you select <Font>, the system will use a font of the 1C:Enterprise interface,
while all other fonts will correspond to the fonts existing in the operating system.
A list of <Font> sizes starts with "<>". Selecting this font size (its value is 0) means
that the font size will match that of the 1C:Enterprise interface. The font effects
(bold, italic, etc.) default to the style settings, but can be customized without any
limitations. If you select another font, all changes to the font size and effects are
reset to the default values.
You can access the style item value programmatically, using the Value property.
Example:
Metadata.StyleItems.NegativeColor.Value
5.5.22. Languages
Languages configuration objects are used to create program interfaces in different
languages. Each configuration object of the Languages type has a separate reserved
string for the metadata attributes that can be represented in different languages.
Let us review a sample form for the Items catalog item. For the Russian language
the form labels look like the following:
If the Languages branch contains more than one object (e.g., Russian and English)
and you want to change the language, select Configuration – Design Language.
Select the configuration viewing language in the opened language selection
window.
The same can be done using the language selection button located on the status
bar to the right of the CAP and NUM buttons (the right bottom corner of the main
Designer window).
The Designer replaces label text with the text in the selected language.
Of course, the label text has to be entered in advance for each control. To enter the
text in the properties palette of the Label control, click the magnifier button in the
Title property (Text or Synonym, depending on the type of control), see fig. 113.
The Strings in Different Languages window will open.
TIP
A configuration can have any number of languages. However, there is no need
to create Languages objects "just in case", since they may be created at any time.
Chapter 5. Configuration Objects 1-249
Language code property contains the language code, e.g., EN for English.
If two or more Languages objects are defined in the configuration, the text editing
button (a magnifier icon) will be displayed for the Synonym and Title properties
of the control.
The first language object is created by the system according to the language
(country) selection for a new infobase.
To create a text representation of an attribute to be displayed in the form, the
following rules are used:
The title of the displayed object is retrieved in the configuration language of
the current user. If the title is specified, it is the one that is used.
The system attempts to retrieve the synonym of the displayed object in the
configuration language of the current user. If the synonym is specified,
it is the one that is used.
Subsequent actions depend on the type of the displayed object:
○○ For standard attributes, a representation in the platform localization
language is retrieved;
○○ For objects created by the application developer, the object name is used as
it is specified in the configuration (including its language).
IMPORTANT!
If the language code in the Language code property is changed, texts in the Syn-
onym or Title properties will be "lost" (they will be stored for the previous code
value). The texts will be "restored" when the previous code value is specified.
For the purpose of text editing and localization (creating an interface in a different
language), use the Edit interface texts mode (see page 2-1021).
If the application is to be used on mobile devices, language codes shall be specified
as per ISO 639 (http://www.iso.org/iso/home/standards/language_codes.htm). Otherwise,
a warning will be displayed during the configuration check.
1-250 1C:Enterprise 8.3. Developer Guide
Fields.Add("RussianDescription");
Fields.Add("EnglishDescription");
Fields.Add("Article");
StandardProcessing = False;
EndProcedure
Chapter 5. Configuration Objects 1-253
StandardProcessing = False;
SessionLocaleCode = Upper(CurrentLocaleCode());
If Find(SessionLocaleCode, "RU") <> 0 Then
Text = Data.RussianDescription;
ElseIf Find(SessionLocaleCode, "EN") <> 0 Then
Text = Data.EnglishDescription;
Else
Text = Data.RussianDescription;
EndIf;
Presentation = Text + "(" + Data.Article + ")";
EndProcedure
To do this, you can use commands that open lists of standard attributes and tabular
sections in the properties palettes of certain objects (see fig. 115). These commands
are available for the objects that own standard attributes and tabular sections.
You can use the properties palette to override some properties of standard attrib-
utes so that they fully meet the requirements of the application task at hand.
For example, you can set Contractor as a synonym for the Owner property of the
Accounts catalog. Then this attribute (Owner) will be represented as "Contractor:"
in all forms by default.
If properties of a standard attribute or tabular section are not specified, default
properties of standard attributes are used instead.
A standard attribute has virtually the same set of properties as any other attribute;
however, you cannot modify the following:
The standard attribute name
The standard attribute type
The standard tabular section name
The standard attribute indexing
IMPORTANT!
If a standard attribute has a description, its name remains unchanged, i.e. it does
not change calls to the attribute from the 1C:Enterprise script and the query
language.
the predefined element Service can be created in the Goods catalog. To call this
element, execute Catalogs.Goods.Service. Individual elements and groups
of elements may be predefined. Groups can be created if predefined elements are
created in hierarchical objects, such as a hierarchical catalog. Predefined data can
be created:
For catalogs (see page 1-280)
For charts of accounts (see page 1-652)
For charts of characteristic types (see page 1-309)
For charts of calculation types (see page 1-665)
When a predefined element is created in Designer, the possibility to create or
update the data elements related to it is defined by a combination of the following
two values:
Configuration object property value PredefinedDataUpdate. Is set
in Designer;
Object property value in the infobase. Use 1C:Enterprise mode and methods
GetPredefinedDataUpdate() and SetPredefinedDataUpdate () to
obtain and set the value for this property.
The property can have three values:
Do not update automatically: in this case the system does not create or update
a data element when predefined data is created or modified. However,
it should be noted that if such a property is set for a configuration object,
an exception may be generated when predefined data is called since a data
element connected with a predefined element is absent;
Update automatically: in this case, the system automatically creates new data
elements (or updates the existing ones) for new (or changed) predefined data;
Auto: the system defines the need for an update automatically. No update
is performed in the following cases:
○○ If the configuration object properties (metadata) have the Predefi-
nedDataUpdate property set to Do not update automatically; the value set
in 1C:Enterprise mode is irrelevant.
○○ If the configuration object properties (metadata) have the Predefi-
nedDataUpdate property set to Update automatically, and Do not update
automatically is set via method SetPredefinedDataUpdate().
○○ If Auto is set in the metadata and 1C:Enterprise mode, and the action
is executed in the subordinate node of a distributed infobase (see page
2-772).
The action to be taken by the system is defined via the AND operation between
a configuration object property and a property of an object specified in 1C:En-
terprise mode. It should be remembered that Auto values do not participate
in defining an action (create or do not create). First, they are resolved into one of
1-256 1C:Enterprise 8.3. Developer Guide
two values: Do not update automatically or Update automatically, and these values
are then used in the AND operation.
A data element is connected to a predefined data element via PredefinedData-
Name. This property facilitates the following:
Connecting a predefined data element with a data element. To do this, assign
the name of a predefined data element to be connected with data to the Prede-
finedDataName property:
ItemRef = Catalog.Goods.FindByDescription("Delivery service ");
Object = ItemRef.GetObject();
Object.PredefinedDataName = "Service";
Object.Write();
This operation maps a predefined Service item of the Goods catalog to a data
item named Delivery service.
When an object is written, the system checks that an infobase contains no other
data element with exactly the same name as this predefined element and set to
the value with which the data element is written.
"Disconnect" a data element from a predefined data element. Assign an empty
line to the PredefinedDataName property and write the element:
Object = Catalog.Goods.Service.GetObject();
Object.PredefinedDataName = "";
Object.Write();
to the peripheral infobase. This method should be called before an initial image
is created.
If a generic data exchange mechanism is used, the following should be taken into
account:
When writing a data object that is a predefined object in the source infobase,
the system checks whether the same predefined data name exists in the type
forming the configuration object. If such name already exists, the object will
be loaded without any changes. If there is no such name, the Predefined-
DataName property will be cleared in the object during loading.
For instance, a common data exchange between similar infobases is performed.
Each infobase includes a Nomenclature catalog. Each infobase of this catalog
contains a predefined Service element. References to these data objects differ.
In this scenario, the following happens during loading: the system detects
a Service predefined element in the destination infobase and performs
loading with the PredefinedItemName property preserved. This is possible,
if the DataExchange.Load property is set to True before the item is written.
Otherwise, an exception will be thrown.
However, if you try to call the Service predefined element in the destination
infobase, an error will occur, as the system cannot have two objects connected
to the same predefined element.
Such a situation should be avoided. The application developer shall handle the
attempt to load a data object with a similar predefined data name on his or her
own.
When writing a data object whose predefined data name references a remote
element (has type #xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx), the
element will still be written. The system will not allow two objects referencing
the same predefined remote element (that have the same predefined data name
value) to be written. The only exception is the case when the DataExchange.
Load property is set to True before writing the element.
For example, you have a Nomenclature catalog with multiple products that start
with Bosch. By entering bos in the nomenclature text box you can obtain a list of
goods that start with this word (see fig. 116).
You can use the following attributes to perform searches:
Code and Description for catalogs, charts of characteristic types, charts of
accounts, charts of calculation types and exchange plans;
Number for documents;
Number and Description for business processes and tasks;
Attributes of the Number or String type with their Index property set to Index
or Index with additional ordering. An example would be the text box for input of
article, barcode or TIN.
To generate a list of attributes, press the selection button and in the dialog box that
opens move the fields for which input by string is permitted to the left-hand list.
For multiple fields, specify the order. When you search for a string, the search will
scan the fields in the same order as their order in this dialog box. For example, for
a Nomenclature catalog item, you can enter items by Code or by Part #. When the
1-260 1C:Enterprise 8.3. Developer Guide
value of an item's code matches the value of another item's Part #, these values will
be listed in the order in which they are specified in the settings.
IMPORTANT!
When you search for data (use input by string), data access restrictions are applied
(see page 1-188).
A property that indicates the group and item selection mode (it is passed for
hierarchical lists only).
In addition, the structure receives items set in the following form element prop-
erties: Choice parameter links and Choice parameters.
The handler also receives a variable it uses to return the generated selection list
and the StandardProcessing parameter that determines the system behavior
after the handler completes its work.
If the developer sets StandardProcessing to False, the complete selection list
must be generated by the developer (considering it can contain up to 50 visible
items).
If the standard processing flag is set to True, the system can generate the selection
list, but you can modify parameters selection (by adding additional filter values,
changing the group and item selection mode, etc.).
NOTE 1
If the selection list is generated by the system, it applies the relevant data access
restrictions (see page 1-188).
NOTE 2
The examples you can see below are not complete. They only demonstrate various
methods of selection list retrieval.
Thus, when a user enters any text, the following code generates a selection list
consisting of three goods with 00000002, 00000003 and 00000004 codes.
Example:
Procedure ChoiceDataGetProcessing(ChoiceDataChoiceData, Parameters, StandardProcessing)
StandardProcessing = False;
EndProcedure
In the example below the filter generated by the text box is extended with an
additional filter that excludes services from the selection list. The selection list
is generated by the system.
Example:
Procedure ChoiceDataChoiceDataGetProcessing(ChoiceDataChoiceData, Parameters, StandardProcessing)
Parameters.Filter.Insert("Type", Enums.ProductTypes.Product);
EndProcedure
1-262 1C:Enterprise 8.3. Developer Guide
The last example is a simplified case of filter implementation by using the
1C:Enterprise script only. This code filters goods with names that start with
a user-entered string.
Example:
Procedure ChoiceDataChoiceDataGetProcessing(ChoiceDataChoiceData, Parameters, StandardProcessing)
StandardProcessing = False;
EndProcedure
Please note there is another method of selection list generation: you can pass
a structure with special content as a value list item instead of a reference to the
object to be found (as in the examples above).
This structure consists of the following items:
Value: A value of the selected item. The structure item with this name
is mandatory.
DeletionMark: A flag specifying that the selected value is marked for deletion
in the infobase. The structure item with this name is optional.
Warning: A string with the warning text displayed by 1C:Enterprise when an
item of this kind is selected from a value list. The structure item with this
name is optional.
If the DeletionMark property in the structure is set to True and the Warning
property is not set, the system auto-generates the warning text. If the Warning
property is set, it is the one to be displayed. Please keep in mind that the
Warning text ends with a question Continue? and has two options to select from:
Yes and No.
Below you can see a modified code from the previous example where warehouses
with the DontUse attribute set to True have the following warning generated:
This warehouse should not be used.
Chapter 5. Configuration Objects 1-263
You can also include both Structure type values and ordinary values in a single
selection list.
Example:
Procedure ChoiceData GetProcessing(ChoiceData, Parameters, StandardProcessing)
StandardProcessing = False;
ChoiceData = New ValueList;
Result = Query.Execute();
SelectionDetailRecords = Result.Select();
While SelectionDetailRecords.Next() Do
Item = ChoiceData.Add();
Item.Value = Structure;
Item.Presentation = SelectionDetailRecords.Description;
EndDo;
EndProcedure
NOTE
If presentations of items (including structure items named Value) are not expressly
specified, they are retrieved automatically.
5.6.7. Forms
Forms are objects created specifically for entering and viewing information and for
managing various processes. The program uses forms to ask the user for information
it needs to continue processing or to display information the user can view and edit.
If you need to ensure the configuration can work in both the ordinary and managed
modes, you can use additional forms of metadata objects. 1C:Enterprise automati-
cally picks the form corresponding to the current operation mode.
1-264 1C:Enterprise 8.3. Developer Guide
Thin clients and web clients only work with managed forms. It means the
following:
If both of the assigned forms are managed, the form marked as the main one
is displayed;
If only one of the assigned forms is managed, it is displayed;
If no managed form is assigned, it is auto-generated.
The thick client picks the form that is the most appropriate for the current run
mode.
If no forms are assigned, the following is generated:
○○ An ordinary form in the ordinary mode;
○○ A managed form in the managed mode.
If only one form is assigned, it is the one to be opened;
If two forms are assigned (an ordinary and a managed form), the following
is opened:
○○ An ordinary form in the ordinary mode;
○○ A managed form in the managed mode.
If two ordinary forms and two managed forms are assigned, the form marked as
the main form is opened.
You can use a duplicate set of forms if you switch your configuration from the
non-managed to the managed mode or if you want to make configuration function-
ality partially available at the web client (or the thin client). In this case you can
implement the required features in the managed forms and mark them as additional
forms. Then the right (managed) forms will be used in the web client (thin client)
mode.
Chapter 5. Configuration Objects 1-265
However, you should remember that default form retrieval in the thick client
is affected by the following configuration properties: Use managed forms in ordi-
nary application and Use ordinary forms in managed application:
If the Use managed forms in ordinary application configuration property is set
to False, retrieving a default form in the ordinary mode at the thick client must
always result in an ordinary form. If neither the main form nor the additional
form is ordinary, an ordinary form is generated. When specified, however, the
default constant form (Default Form property) is used regardless of whether
Use managed forms in ordinary application is checked or not.
If the Use ordinary forms in managed application configuration property is set
to False, retrieving a default form in the managed mode at the thick client
must always result in a managed form. If neither the main form nor the addi-
tional form is ordinary, a managed form is generated.
If a form opens that is automatically generated by the system and the client
application run mode is different from the run mode set in the Default run mode
configuration property, the object forms and recordset forms are opened only
in Read only mode. Generate commands will not be included in list forms and
object forms and Create commands will not be included in list forms, if to run
these commands the system needs to automatically generate a form applicable
for the current run mode and the client application run mode is different from the
mode set in the Default run mode configuration property.
If a managed application is selected as default run mode, a form purpose can
be selected for each managed form of the application. The form property Use
purposes is equivalent in terms of content and usage to a similar configuration
property (see page 1-163). Form editor behavior depends on a cross-section of
multiple configuration purposes and the specific form.
If such a cross-section has no value, Personal computer is specified:
The properties of attributes, parameters, commands, and elements that are not
supported by a mobile platform are unavailable in the property palette.
Editing the context menu of a form item is unavailable.
Editing an extended tooltip of a form element is unavailable.
Form fields that are not supported by a mobile platform are unavailable (see
page 2-919).
The dynamic list settings editor does not support expanding available fields
(this is due to the fact that a dynamic list on a mobile platform only works
with one table).
If a purpose of the form does not include Mobile application, it is not included
in the mobile application configuration.
1-266 1C:Enterprise 8.3. Developer Guide
5.6.8. Commands
You can perform operations with a specific metadata object using this object's
commands. Please note that non-parameterized commands of the object are avail-
able in the command interfaces of subsystems that include this metadata object. If
a command is parameterized, it is available in forms that contain form attributes
(including top-level subordinate attributes of the main form attribute) of the same
type as the command parameter type.
Commands require command execution procedures. To write these procedures, use
the command module for where you need to implement CommandProcessing()
handler. This procedure must be preceded by the &AtClient directive because
the command is executed in the client application. However, other procedures
and functions in the command module can be preceded by other directives
if it is required for command execution. For details on compiler directives see
page 1-161.
A command module could contain, e.g., a procedure that opens a report form
with a preset parameter to print out a specific account card or a procedure that
opens a product list form with a predefined filter by product type. If a command
belonging to the Navigation panel group should open the same form in different
tabs, you should specify a unique key or a unique form parameter to receive (or
open) a form.
NOTE
If a command is located in the main application window navigation panel (see
page 1-83), re-selection of this command will not lead to its repeated execution.
This applies both to standard commands and commands created in the configu-
ration.
Charts of accounts
Charts of calculation types
Information register record sets
Business processes
Tasks
The Filling() handler uses the FillingData parameter to retrieve the filling
data. Depending on how you call the handler, the FillingData parameter can take
on different values:
Generation based on another object: A reference to the source object is passed
as a parameter value. In this case the FillingData parameter is a reference to
the database source object.
Selection from a list with a filter applied: The passed parameter value is a
structure that contains filter items with their comparison type set to Equal to
or In list (the list has a single value). When a new document is created in the
document journal form, items of the journal column filter are preliminarily
converted so that the FillingData structure item is named after a document
attribute rather than a journal column.
Input of a new object or record without applying a filter: The parameter value
is Undefined.
Input of a new object or record using a global command: The parameter value
is Undefined.
Execution of OpenForm()/GetForm() methods from 1C:Enterprise script: If
OpenForm()/GetForm() methods result in a new object form, a Structure
type value of the FillValue form parameter is passed as a parameter value to
the FillingData handler. If the FillValue parameter is not specified in the
form parameters, the handler parameter value is set to Undefined.
Calling the Fill() object method from 1C:Enteprprise script: The passed param-
eter value is the information passed as a Fill() method parameter.
NOTE
When a new object is created interactively by copying, this operation is pro-
cessed in the OnCopy() handler of the corresponding object.
If attributes are filled in from the filling data, this process is affected by the Fill
from filling data property of the metadata object attribute. If this property is set to
True, the attributes are auto-filled by the system from the filling data. If the prop-
erty value is False or the filling data do not contain the required value, the system
attempts to fill in the attribute using the Fill value property.
IMPORTANT!
A developer can control how both custom and standard object attributes are
filled in. For example, the developer can disable auto-filling the Parent standard
attribute with the current group.
1-268 1C:Enterprise 8.3. Developer Guide
AccumulationRegister – Period
AccountingRegister – Period
CalculationRegister – RegistrationPeriod, CalculationType, BegOfAc-
tionPeriod, EndOfActionPeriod
BusinessProcess – Date
Task – Description
5.6.10.2. Procedure
Fill auto-check is called by a form extension before all objects, except docu-
ment, business processes, report and data processors, are written interactively.
The following behavior is defined for the following objects:
For documents:
○○ Fill check is called by the form extension before posting if the Post property
is set to Enable;
○○ Fill check is called by the form extension before writing if the Post property
is set to Disable;
For business processes fill check is called by the form extensions before the
start;
For report fill check is called by the form extension when the Create button
is pressed;
For data processors fill check is called by the form extension in cases when
buttons related to standard form commands are pressed: OK, Yes, Retry, Ignore.
If an attribute is the main form attribute with one of the following types:
CatalogObject, DocumentObject, ReportObject, ChartOfCharacteris-
ticTypesObject, ChartOfAccountsObject, ChartOfCalculationTypesOb-
ject, BusinessProcessObject, TaskObject, a fill check is also called for its value.
For the system to call the fill check, the form where you work should have its
Check fill automatically property set. In this case the system calls the form's Fill-
CheckProcessingAtServer() handler first and then calls the object module's
FillCheckProcessing().
IMPORTANT!
If the form's Check fill automatically property is set to True when you execute
standard commands, such as Write (Post for documents, etc.) or standard form
commands (OK, Yes, Retry, Ignore), the FillCheck() method is called. Otherwise
the fill check is called neither for the form nor for the object.
The following procedure is used for fill checking:
A list of form attributes that can be checked for filling and have their
FillChecking property set to ShowError is created. This list does not include
attributes of the type that does not support fill checks (e.g., CatalogObject);
however it includes the main form attribute name.
Chapter 5. Configuration Objects 1-271
Form attributes disabled by functional options will not be included in an auto-
matically generated list of attributes.
The form's FillCheckProcessingAtServer event handler is called; a devel-
oper can use it to describe a custom fill check algorithm or modify the list of
attributes to be checked. The created list of attribute names is passed to the
handler. You can only add attributes to the list in the handler if they belong
to the types listed above (that support fill checks in forms) or are the main
attributes. Adding object-type attributes (e.g., CatalogObject) to the list raises
an exception during the subsequent auto-check. Adding a non-existing attribute
name to the list raises an exception during the subsequent auto-check.
When the event handler execution is completed, the fill check procedure
gets a list of the checked attributes (the list might have been changed by the
handler). The system analyzes the list of attributes and checks each attribute
for filling. If an attribute is a main object-type attribute (e.g., Object of the
CatalogObject type), the fill check is called for the object. If an attribute
is an object-type attribute, but is not the main attribute, an exception is raised.
A developer can modify the check process by defining a FillCheckProcessing
event handler in an object, record set or form module.
This allows the developer to gain full control over fill checks. The Chec-
kedAttributes parameter is used to pass an array of parameters that are selected
for the check in the Designer to the handler. The developer can modify this array
in any way:
Delete the attributes that undergo custom checks or do not need to be checked
now;
Add the required attributes that need to be checked for filling.
If the developer does not want to use the standard check procedure, he or she can
use a custom algorithm instead and implement the UserMessage object to notify
users of the detected issues.
If the check process displays error messages to the user, the Cancel parameter
should be set to True for the platform to know that the current action cannot be
completed.
The CheckedAttributes event parameter contains attribute names in the
following formats:
For attributes and constants – AttributeName, e.g. Vendor;
For tabular sections – TabularSectionName, e.g. Goods;
For tabular section attributes – TabularSectionName.AttributeName, e.g.
Goods.Nomenclature;
For form attributes – AttributeName, e.g. DocumentObject.
If attributes are a part of functional options (see page 1-211) without param-
eters, option values are accounted for during fill checks. If the functional option
1-272 1C:Enterprise 8.3. Developer Guide
is enabled, the attribute is added to the list of checked attributes; otherwise the
attribute is not added to the list. It means the disabled field is not passed to Fill-
CheckProcessing in CheckedAttributes parameters.
If attributes are a part of functional options with parameters (see page 1-211),
they are always included in the list of checked attributes (CheckedAttributes
parameter). In this case if you want to delete an attribute from the checked attributes
list, you should use the FillCheckProcessing handler. First, you need to retrieve
a value of the functional option by specifying the required object data as parameters.
5.6.12. Rights
You can edit rights of access to configuration objects both in the editor of role
access rights (see page 1-185) and in the object editing window (see page 1-59).
You can use the object editing window to set up access rights for a specific object
in all roles existing in the system.
You are allowed to set access rights:
For metadata objects
For tabular sections
For object attributes
1-274 1C:Enterprise 8.3. Developer Guide
Values indicated in this property are passed to the form to be opened through the
Parameters structure. Please note that the value in the Name column matches the
structure item key, while the attribute value in the Attribute column corresponds
to the structure item value. If the Name column contains a value of the Filter.
Owner type, a Filter parameter (of the Structure type) is created for the form.
The item created in this structure will have the Code key and a value retrieved
from the attribute indicated in the Attribute column (Supplier in this example).
If the name of an item in Choice parameters links matches the name of an item
in Choice parameters, the item from Choice parameters links will have maximum
priority (the item from Choice parameters is ignored), when the value of the field
specified in the Choice parameters links item and passed to the ValueIsFilled()
function returns True. At that the item from the Choice parameters property
is ignored.
You can also use the choice parameter links window to clear the field when link
fields are modified. If the Edit mode of the linked value property is set to Clear,
the field is cleared when the link value is modified interactively (selecting the
value previously specified in the field again is also a modification) before the
OnChange event. Otherwise the field is not cleared (the property value is Do not
change). Elements are cleared regardless of a real value change in the link element
beforethe OnChange event handler is called.
If the field displays table data (a table column or an individual field associated with
the current data), it is cleared if the source of data for the form table is Form-
DataCollection or FormDataStructureAndCollection. If the attribute you
want to clear is associated with table data, while the link attribute is not, values
in all table rows are cleared.
1-276 1C:Enterprise 8.3. Developer Guide
The attribute cannot be cleared if it is associated with a column of the Dynami-
cList type attribute.
For a standard Parent attribute of a subordinate catalog the Choice parameters
links property can be changed by the system automatically. It could happen in the
following cases:
When the catalog subordination state changes;
When the Hierarchical property value for the catalog changes.
The following procedure is used:
If the catalog is subordinate and hierarchical, a value with Name = Filter.
Owner and Attribute = Owner is added in the list of Choice parameters links
property values for the Parent attribute;
Otherwise the value with Name = Filter.Owner and Attribute = Owner
is removed from the list of Choice parameters links property values for the
standard Parent attribute.
Review the following example: a form contains Vendor and VendorAccount
fields. The ChoiceParameterLinks property for the VendorAccount field is set
to Object.Vendor that is displayed in the Owner filter field.
Then, if you change the Vendor field value interactively, the VendorAccount field
value is auto-cleared.
Values indicated in this property are passed to the form to be opened through the
Parameters structure. Please note that the value in the Name column matches
the structure item key, while the value in the Value column corresponds to the
structure item value. If the Name column contains a value of the Filter.Code type,
a Filter parameter (of the Structure type) is created for the form. The item
created in this structure will have the Code key and the Value value.
If the name of an item in the Choice parameters links property matches the
name of an item in the Choice parameters property, the item from Choice
parameters links will have maximum priority (the item from Choice parameters
is ignored). The item priority is maximum when the value of the field specified
in the Attribute parameter of the Choice parameters links item is filled (the
ValueIsFilled() function returns True for this value).
1-278 1C:Enterprise 8.3. Developer Guide
NOTE
Values specified in the Choice Parameters attribute property are also used by
dynamic lists and the data composition system.
If you select extra dimension values in a table cell linked to an accounting register
recordset, the selection parameter is automatically set for the Owner field, but only
if this type of extra dimension has an additional catalog type of extra dimension
values. The corresponding extra dimension type is the selection parameter value.
5.6.16. Other
The Use standard commands property defines whether standard commands of
a particular object (e.g., commands that open a catalog list) can be added to the
command interface. If this property is set to False, the standard commands are
not displayed in the system and you can only include the object in the interface by
using a command created in the Designer.
The Choice form property determines a form to be used when selecting an attribute
value. It is used for attributes with the types based on metadata objects that use
forms. For example, a Goods catalog might have multiple selection forms, but the
standard Parent attribute requires a special form. If you want to implement this
behavior, specify this form in the Choice form property for the standard Parent
attribute (for details on standard attributes see page 1-253).
Format is used for Number, Boolean and Date types and defines a format to be
used when attribute data are displayed.
The Editing format property sets a format to be used when editing data of Number,
Boolean and Date types.
Link by type establishes a relational link with the attribute determining the types of
values entered in the text box. It is useful to set up type links for attributes that
have a composite data type and are logically linked to another attribute, such as
ChartOfChartOfCharacteristicTypes.Ref, possibly creating a link between
an attribute that contains an extra dimension with an attribute that contains a value
of the ChartOfAccountsRef type. An item of the type link contains the number of
extra dimension type in case the attribute selected for the type link has a value of
the ChartOfAccountsRef type.
For example, you might have two attributes – CharacteristicType and
Characteristic. The CharacteristicType attribute's type is ChartOfChar-
tOfCharacteristicTypesProductCharacteristicTypes.Ref, while the
Characteristic attribute's type is Characteristic.ProductCharacteris-
ticTypes. You can set the Characteristic attribute's property Link by type to
CharacteristicType. In this case the selected value type is defined by the type
specified for the selected value of the chart of characteristic types.
Chapter 5. Configuration Objects 1-279
5.7. CONSTANTS
In 1C:Enterprise, constants are used to store permanent or nearly permanent
information. This information either does not change at all or changes quite infre-
quently. For example, the names of companies usually do not change.
The main reason for using constants is that once information is put there, it can be
used for preparing documents, in calculations or in reports. Constant values may
be edited when necessary.
Let us look at an example. Company documents are usually signed by the director
and the chief accountant. Of course, the officials themselves must sign the docu-
ments. However, aside from the signature, it is necessary to provide the signature
drill down – last name of the person who has signed the document. Of course,
it is possible to enter the names of the director and chief accountant directly in the
document forms. However, if one of the last names changes, you will have to edit all
of document forms and correct the last names all over again. So it is much easier
to create two constants for the last names of the director and the chief accountant
and use these constants in the document forms instead of their values. If there is a
new director or chief accountant, you only have to change the constants by entering
new names and the changes will be automatically implemented everywhere these
constants are used.
IMPORTANT!
When value of a constant changes, the previous value is lost. To get the previous
data values, you have to use an information register with no dimensions instead
of constants.
The 1C:Enterprise Designer can be used to create any number of constants for
storing any information.
5.8. CATALOGS
Sometimes, when document forms are filled out, it is necessary to enter informa-
tion by selecting a value from a preset list.
Let us take an application form to be completed when applying for a job as an
example.
When filling out the Place of birth field, it is necessary to specify a city or town.
Although the total number of cities and towns is quite big, it is finite. Actually,
it is possible to specify a place of birth by selecting a city or town from a list.
This list is called a catalog.
A catalog is a list of possible values for a certain attribute of a document (in its
broadest sense).
Catalogs are used when it is necessary to ensure consistent information input.
For example, it is necessary to use the same name for an item so that different
employees (salespersons, managers and warehouse staff) understand what the item
is. In this case a catalog is also needed. Usually in mercantile business such
a catalog is stored as a price list. If such a catalog is stored in electronic form,
it contains all of the possible items that a business works with.
1C:Enterprise makes it possible to maintain any number of catalogs. Each catalog
represents a list of consistent object instances: employees, organizations, goods,
etc. We will refer to each object item as a catalog item.
Please keep in mind that the configuration is only used to create the structure of
a catalog, while its contents, i.e. catalog items, have to be entered by the user.
In the configuration process, it is necessary to describe the structure of the
information that will be stored in the catalog, develop the screen and/or print repre-
sentation of the catalog and specify various characteristics of its behavior.
Catalogs usually have predefined code and description attributes. The code number
may be of a Number or a String type.
The 1C:Enterprise system provides you with a wide range of options for working
with catalog item codes: the codes are automatically assigned and checked for
uniqueness, etc.
A catalog in 1C:Enterprise may have a hierarchical structure. There are two types
of hierarchies – the folder and item hierarchy and the item hierarchy. In the
first case, all data in the catalog are divided into two types: catalog items and
catalog folders. Folders are logical blocks of catalog items. For example, a catalog
of goods, where the folders are types of products (Plumbing Systems, Household
Chemicals, etc.) and the items are specific products (Mixer, Mirror, Detergent),
is a hierarchical catalog.
Using hierarchical catalogs makes it possible to enter information with the required
level of detail. Items and folders in a hierarchical catalog can be moved from one
group to another.
Chapter 5. Configuration Objects 1-281
There are no folders in catalogs with the Item hierarchy. In this case some items
may also act as folders. In such catalogs, all of the items have the same func-
tionality. A list of company departments is an example of such a catalog. Each
department may be described by the same set of attributes; however, it may logi-
cally contain another department or be a component of another department.
For hierarchical catalogs, the Designer makes it possible to specify a limit on the
number of catalog levels or to use an unlimited number of nested levels.
In addition to code and description, you can create a set of attributes to store addi-
tional information about items in the catalog.
For example, the Contractors catalog may contain information such as the full
description of a contractor, tax ID number, the last name of the director and the
chief accountant and other information.
If an object of the application domain corresponding to the catalog has both simple
properties like a full description or tax ID and composite (list) properties, you can
create a set of tabular sections for the catalog.
For example, you can create a tabular section for the list of contractor's telephone
numbers in the Contractors catalog.
The names of catalog attributes should not match the names of attributes in a
tabular section.
To work with information stored in a catalog, you can create on-screen forms. You
can create separate forms for viewing, editing and selecting items from a catalog.
The Designer allows you to create multiple forms of the same type, e.g., forms for
selecting an item from the catalog and use them in different situations.
We recommend creating separate forms to display the list of items and to select
catalog items.
Folders on top – this property becomes available when Folder and item hierarchy
is selected. If the Folders on top property is set and the catalog is displayed as
a hierarchical list, its folders are placed on top, above all items. If this property
is not set, the folders and items will be arranged according to the specified sorting
rules (by code, description, etc.). For example, if a new folder has a code greater
than the codes of all other folders and items (when sorted by code), in the former
case this folder will be placed below all other folders, but above all other items;
in the latter case it will be placed below all folders and items.
Please note that the Folders on top property does not affect how the catalog
is displayed as a non-hierarchical list.
Number of hierarchy levels becomes available if the Limit the number of hierarchy
levels check box is selected. Catalogs in 1C:Enterprise can have more than one
nested level. If the Limit the number of hierarchy levels property is not set, the
catalog may contain an unlimited number of nested levels.
Owners: This property has to be explained in detail.
Any catalog may be used independently or as a subordinate to another catalog. For
example, a catalog of contracts may be used independently or may be linked with
a catalog of companies.
To make a catalog subordinate to any existing catalog, click the editing button
in the List of catalog owners field and specify the catalogs that own this catalog
in the object selection window. In 1C:Enterprise, the owning catalog is called the
owner and the owned catalog is called the subordinate.
Unlike multi-level catalogs, where all items have the same structure, the mecha-
nism of subordinate catalogs makes it possible to connect items with different
structures. In this case each item of the subordinate catalog will be logically linked
to one of the items of the owner catalog.
For catalogs with several owners, different items may have different types of
owners, but one item can have only one owner.
Subordination type allows you to manage owner restrictions. This property speci-
fies whether the owner can use only items, only folders or both. If a catalog has
several owners, the restriction applies to all of them.
Code length: This property specifies the maximum length of code for catalog
items.
You can specify zero code length in the Designer if a catalog item code is not
used.
When this property is specified, it is desirable to determine the code length that
is actually possible. Please keep in mind that you can increase code length when
needed as you operate the configuration.
NOTE
The maximum code length is 50.
Chapter 5. Configuration Objects 1-283
Description length specifies the maximum length of a description for catalog items.
You can specify zero description length in the Designer. It means the catalog has
no description.
NOTE
The maximum description length is 150.
The Code series property is used to specify the range for checking code unique-
ness and for automated code assignment.
If this property is set to In the entire catalog and you automatically assign or
manually enter a code, its uniqueness is checked against all items of the catalog.
The Within subordination area setting works for hierarchical or subordinate catalogs
only. In this case the system checks code uniqueness only within folders and items
of the owner catalog where a new catalog item is added or where an existing item
is edited.
When the code series is set to Within Subordination area, catalog items in different
folders may have the same codes. Please keep it in mind when moving items
of a multi-level catalog from one folder to another. If the code of an item that
is moved is the same as the code of an existing folder item, a warning message
is displayed and the item is not moved.
When the code series is set to Within owner subordination area in hierarchical
subordinate catalogs, all codes with the same owner and different parents are auto-
numbered and checked for uniqueness.
The Code type property is used to select a value type for the catalog item code –
Number or String. String type codes are useful for complex coding systems
in which the code may contain numbers, letters and separators. Articles of clothing
may serve as a typical example of a String code.
Please note that String type codes can also be assigned automatically.
For the first item, the system creates a code that looks like 001 (the number of
zeros depends on the specified code length), i.e., the code is a string of characters
where all characters are numerical. When other items are added to a catalog, the
system will keep assigning item codes: 002, 003, etc.
If catalog maintenance requires using mixed alphanumerical codes, codes like
AA001 can also be used for auto-numbering. The first component of the code here
(АА) is a text prefix, while the second component (001) is interpreted as a number
and used for auto-numbering.
For example, if the first code is АА001, the second code will be АА002, the third
code will be АА003 and so on.
A text prefix may be set manually (you can use a composite code when adding
a new item to the catalog) or using the 1C:Enterprise script (SetNewCode()
method).
1-284 1C:Enterprise 8.3. Developer Guide
Allowed code length is available if the Code type property is set to String. You
can use this property to adjust the length of the string to store the code. If the
property value is Fixed, the length of the string storing a catalog item code always
equals the value specified in the Code length property. Otherwise the string length
equals the actual number of characters in the item code.
Attributes. A new catalog can be viewed as a table with two columns: the catalog
item code and its description. 1C:Enterprise can store additional information about
catalog items, other than the description and code. When you edit a catalog, you
can specify a set of additional attributes for storing such additional information.
When a catalog is displayed on the screen, these attributes may be displayed as
columns in the table box of the catalog's list form. In addition, the information
stored in attributes may be used in different calculations, reports, etc.
For example, it is easy to use catalog attributes to organize an employee table. To
do this, you need to create attributes that would store information about education,
personal data and other HR data in the Employees catalog. Simple built-in search
tools make it easy to find the required information about an employee in the
catalog when using the configuration.
Tabular sections. Tabular sections are used to describe information that is related
to the catalog, but is not used independently. For example, a tabular section may
contain information about an employee's family (information about each family
member will be described in attributes of the tabular section and there can be any
number of family members), the employee's job record, etc.
In the example above, if it were possible to use information about employees'
families independently, you could put this information in a separate catalog which
would be subordinate to the Employees catalog.
The main difference between a tabular section and a subordinate catalog is that
it is possible to reference items of a catalog, unlike lines of a tabular section.
When a catalog is accessed, it is loaded into memory together with all tabular
sections. If a tabular section has many lines, this may decrease system perfor-
mance. Therefore, it is recommended that tabular sections be used when there
is no need to store item references and when the count of items is limited. Each
catalog may contain an unlimited number of tabular sections.
Autonumbering. If this property is set, a code will be automatically assigned to
each new item in the catalog. Auto-assigned codes can be modified.
Check uniqueness. If code is used to identify a specific item in a catalog, this
code should be unique (have no duplicates). If the Check uniqueness property
is set, the code will be automatically checked for uniqueness each time a new item
is added to the catalog.
Default presentation specifies how catalog items are displayed. For example, values
of the CatalogRef type in a document or catalog attribute or a constant, will
be displayed as the code or description of a catalog item depending on the prop-
Chapter 5. Configuration Objects 1-285
erty value. For list forms, this column becomes the default column. When a list
is opened, this column becomes active.
Generation. The Generation tab specifies which configuration objects may serve
as a basis for objects of a given type and for which objects the objects of a given
type may serve as a basis. The Generation settings wizard button launches the
"Create Based On" wizard. For more details on working with the wizard, see page
2-985.
An example of document generation is entering a Warehouse Transfer document
based on an item of the Goods catalog.
5.9. DOCUMENTS
A document is one of the main concepts in 1C:Enterprise. Documents are used to
enter information about business transactions into the system.
Most documents that are created during task configuration are electronic coun-
terparts of standard paper documents; however, in addition to recording business
transactions, this data type may be used to save other data, too.
Every document contains information about a specific business transaction and
is characterized by a number, date and time. Date and time are the most important
1-286 1C:Enterprise 8.3. Developer Guide
document characteristics, since they make it possible to determine the sequence of
operations.
The configuration only describes the document structure; specific document
instances have to entered by a user working with the program. For example, the
Invoice document in 1C:Enterprise may be used to prepare invoices with different
contents and the same attribute sets, the same logic of behavior, etc.
Hereinafter, document structure is referred to as a document, i.e. tools for docu-
ment input and visualization.
The Designer can be used to describe a document structure, arrange forms for
entering information in a document and describe the algorithm of print form crea-
tion for the document.
In addition to the date, time and document number, you can create a set of attrib-
utes for storing additional information.
If an object of the application domain corresponding to the document has both
simple properties like date, number and total amount and composite (list) proper-
ties, you can create a set of tabular sections for this document.
For example, you can create a tabular section for a list of items in the Goods
Issue document.
A configuration may contain any required count of lists of documents with the
same type and document journals with different types. List forms do not have the
Document type column (since lists contain documents of the same type), while
journals usually do contain this column.
When a document is created, you can specify a list of journals that will be used
for working with this document. You can specify one journal for different docu-
ment types which will allow you to group documents in the journals as needed.
You can change the journals assigned to a document.
Documents can change the status of accounting registers (when they are posted).
If a document has been posted, the data specified by the user when entering the
document affect the system accounting registers, i.e. modify inventory balances,
amounts due to contractors, etc. You can post documents in real time (real-time
posting) or backdated (regular posting).
The Posting tab is used to set up behavior during document posting and posting
cancellation.
Posting specifies whether the document can be posted when it is saved. If this
property is set to Enable, the document modifies the register records (changes
their state). This selection also automatically calls the Posting event handler for
document posting in the 1C:Enterprise mode which opens when a button with the
predefined Save and close action (usually an OK button) is clicked. You can use
the register record wizard (see page 2-980) to create the Posting event handler.
Open the wizard by clicking the appropriate button at the Posting tab in the Docu-
ment object editing window.
Real-time posting specifies whether real-time posting is enabled for a document.
When a non-current date is selected, documents with enabled real-time posting are
posted in regular mode, because in this case an accomplished fact that does not
require real-time verification (e.g., checking the balance in the product's invoice)
is being recorded.
If Real-time posting is turned on for a document, then zero time is set for a new
document. Upon posting, the system receives a real-time timestamp which may be
the same as or greater than the current date and time and assigns this time stamp
to the document. After that, the document is posted in real time. For details on
real-time timestamp see page 1-292.
If a document being edited has Real-time posting turned on, the time differs from
the current time and when the document is posted (if the current date is speci-
fied), the system asks what type of posting should be used. If you select Real-time
posting, then the system sets the current time for the document. If you change the
time when the document is edited (e.g., if you specify future time of the current
day), the system also sets the current time for the document. If you select Regular
posting, then the system sets the time to the beginning of the day if the date format
does not require entering the time.
Register records deletion is available if the Posting property is set to Enable.
This option defines how all records saved during document posting are deleted
when the document is reposted or unposted:
Delete automatically means the system deletes the records when a previously
posted document is reposted (prior to writing new records) or when document
posting is canceled.
Do not delete automatically means register records are deleted programmatically
in special cases. Use this mode to manage deletion during both posting and
unposting.
Delete automatically on clearing posting means the system automatically deletes
register records only when posting is canceled. Reposting will not result
in automatic record deletion. This mode is used by default.
Chapter 5. Configuration Objects 1-289
If the Register records deletion property is set to Do not delete automatically or
Delete automatically on clearing posting, you should clear any Register Records
collection recordsets before the posting operation to avoid information duplication.
Add register records on posting defines how the system behaves when register
records are created during document posting:
Record selected (default mode) means a record set of the register record collec-
tion is only written if the Write property of the set is True (regardless of
whether the records in the set have been modified or not).
Record modified (this mode is set when migrating from 1C:Enterprise 8.1 and
older versions) means that the system write the record sets that have been modi-
fied (their Write property is automatically set to True).
After the document is written, the system resets the Write property for all record
sets that register document records, even if the write operation failed.
Sequence filling sets the automated sequence filling mode. The Sequences tab of
the Edit window specifies whether the document is part of a sequence.
At the Journals tab in the document editing window, you can mark document
journals that will display documents of this type for 1C:Enterprise users. You can
create the required document journal forms later.
The Generation tab contains two lists of configuration objects. The top list should
contain objects that may serve as a basis for the document and the bottom list
should contain objects for which this document may serve as a basis.
IMPORTANT!
A document may be entered on basis of another document or based on objects
of a different type (items of catalogs, charts of characteristic types, charts of
accounts or charts of calculation types). A document may also serve as a basis
both for other documents and for objects of a different type.
If you want to create a procedure for preparing the created object data based on
a sample, use a special wizard. For a description of this wizard see page 2-985.
The Rights box allows you to set the privileged mode for posting (Privileged
mode for posting property) and/or for unposting documents (Privileged mode for
unposting property):
If this property is set, the system will always post or unpost document in the
privileged mode (at the server side and in file mode version). However, the
privileged mode is not set if a document is posted or unposted in the client/
server mode at the thick client side. The privileged mode enables you to do the
following:
○○ Autodelete register records;
○○ Autowrite register records;
○○ Use an appropriate handler (Posting or UndoPosting). However, objects
are written in the regular (non-privileged) mode.
1-290 1C:Enterprise 8.3. Developer Guide
The privileged mode is enabled by the system after the object is written, but
before posting starts (before register records are deleted if it is done automati-
cally). The same procedure is used when unposting.
When new documents are created, these properties are set to True if the
managed application mode is selected as the main run mode in the configu-
ration properties; otherwise if the ordinary application mode is selected, the
properties are set to False.
The posting option (real-time or regular) for a document is selected on the basis
of its date. If the posted document date matches the current date, the system posts
the document in real time without additional queries. The option is defined by the
posting data processor which determines the specific algorithm of document posting.
The point in time concept is implemented in the 1C:Enterprise script using the
universal PointInTime object.
If multiple documents have identical dates and times, their sequence on the time
axis is established based on the references. This sequence may differ from the
sequence of document creation and cannot be changed by the user. i.e. the user
cannot change the sequence of documents within a second or figure out which
document is created earlier or later.
5.9.3. Numerators
A numerator is a configuration object that defines document numbering rules:
document number type and length, periodicity, requirements for uniqueness check.
The main purpose of the numerator is to provide continuous numbering for docu-
ments of different kinds. For this purpose, the same numerator is assigned to such
documents.
Number Type. Type of document number value: numeric or text. Text numbers
are useful for complex document numbering systems. The document number may
contain numbers, letters and separators.
Number Length specifies the maximum length of a document number.
Periodicity specifies the two important characteristics of the numerator: document
number uniqueness check and the number repetition period.
If the Check Uniqueness property is turned on, Periodicity specifies the range for
checking.
For example, if Within a day is set as the periodicity option, document number
uniqueness will be controlled within a 24-hour period: on the next day, the docu-
ment numbers may repeat; however within the same day they will be unique.
If Autonumbering is turned on (see page 1-286), 1C:Enterprise will assign a new
sequence number to each new document. When the period specified in Periodicity
expires, document numbering restarts from 1.
If the Check Uniqueness property is set, the number of each new document
is checked for uniqueness, subject to the restrictions specified by Periodicity.
When a document is posted in 1C:Enterprise, the system performs certain actions
that are recorded by the document in multiple accounting mechanisms supported
by 1C:Enterprise.
The document posting algorithm usually records information saved in a document
(in its attributes and tabular sections). However, in some cases, the document
posting algorithm also analyzes current totals and uses them in posting. For
example, if a document is used to write off goods or materials at average cost,
the algorithm determines the write-off amount by analyzing the inventory balances
of goods (or materials) at the document time. If goods or materials are written off
using LIFO or FIFO methods, the posting algorithm will analyze the remaining
inventory balance of goods (or materials) by lots for date and time of document
posting.
It is obvious that posting of documents based on total results should follow a strict
sequence. However, it often becomes necessary to input or correct some docu-
ments post factum, due to human errors or document delays. In this case posting
of register records generated by subsequent documents (created after the corrected
document) will be considered incorrect. For example, if it turns out that a receipt
that was entered at the beginning of the month contained the wrong amount of
goods, it is necessary to reanalyze all subsequent invoices that write off available
lots and to re-write the register records. In other words, all documents that analyze
the remaining inventory and come after the changed document have to be reposted.
Sequences branch objects are used for automatic check of document reposting.
Each Sequence object in the configuration checks posting of documents of the
specified types. Therefore, there may be multiple independent sequences in the
system.
Move the boundary when posting. If the Move option is enabled, when you post
a document registered in this sequence, it will try to move the boundary of the
sequenced documents. If the property value is Do not move, the posted document
will not move the boundary of this sequence.
Incoming documents. The top list of the Sequence window contains document
types for a specific sequence.
Select documents types that analyze values of different registers during posting
as documents affected by this sequence. Such documents may include invoices,
transfer orders, sales orders, etc.
Register records that affect the sequence is one of the main sequence proper-
ties. It defines register records that will influence re-posting of documents in the
sequence, i.e. accounting mechanisms that will be used for posting of documents
in the sequence. For example, such records may include register records.
To configure this parameter, add register types that influence the current sequence
to the list.
Dimensions. Sequences may have subordinate objects known as dimensions which
are created on the Data tab of the Edit window.
If no dimensions exist for a sequence, then all incoming documents will be
reposted when this sequence is restored. If you want the sequence to cover specific
rather than all situations, add a dimension to the sequence. In this case re-posting
will be needed only for documents that change the register value allowing for the
dimensions properties.
Chapter 5. Configuration Objects 1-297
If sequence register values change, all later documents with the same attribute
values (listed in the Document Attributes Mapping dimension property) included
in the attributes of the deleted (added) register records (listed in the Register
records attributes mapping dimension property) become invalid.
For example, a sequence takes into account register changes for Goods Receipt
and Goods Issue documents. If additional criteria need to be taken into account
for reposting of specific documents (e.g., it is necessary to repost documents
related to a specific item), then a dimension has to be added to the sequence.
Use the dimension's properties palette to specify the dimensions type (Cata-
logRef.Nomenclature) and to link it to register attributes.
Depending on the dimension type selected, document lists and dimension register
lists only contain objects with the specified type of dimension.
Implementation of dimensions makes document reposting faster which is espe-
cially important for large volumes of documentation, since only documents
containing the specified data will be reposted.
the boundary is moved backwards, the system checks if there are other boundaries
to be moved backwards. This check does not require exclusive boundary lock.
Therefore, the sequence boundary will move forward with sequential posting of
documents in this sequence and will move back if register records for this sequence
are modified post factum.
There is a special feature to restore the document posting sequence in the docu-
ment reposting mode (All functions – Standard – Document Posting). When this
feature is used, the system automatically reposts all documents belonging to this
sequence from the sequence boundary up to a specified location.
In the example with goods accounting, posted invoices will move the sequence
boundary forward. If any modification of records in the register used for cost
accounting of goods is written before the sequence boundary, it will move
the boundary back to the time of this document. After that, posted documents
positioned after the sequence boundary no longer move it forward if there are
any posted documents of this sequence between the sequence boundary and the
currently posted document. Restoring the sequence reposts all invoices. Please note
that receipts, although influencing the sequence boundary, are not reposted, since
their posting algorithm does not use balances and they are not included in the list
of documents belonging to this sequence. After restoring the sequence, documents
that are posted after the sequence boundary will move the boundary forward.
The Restore sequences mode makes it possible to automatically repost all docu-
ments related to the sequence from the current position of the sequence boundary
to a specified moment. In this case you need to select a position that will limit the
document reposting at the top of the dialog.
IMPORTANT!
You cannot select more than one attribute of the same document.
If an attribute of a document is not selected, the column of the document journal
will contain no information for all documents of this type. Your selection should
be based on common sense. It is not reasonable to include entirely different
documents in the same column (e.g., a contractor description and a document's
amount).
You can add any number of columns to the journal in addition to the obligatory
document columns (Date, Number, Document type) and columns specified in the
subordinate group of Graph journal objects.
Chapter 5. Configuration Objects 1-301
If all the documents with a string type number in the journal have a fixed number
length, then the Number column of the journal will also be of a fixed length. When
at least one document with a string type number in the journal has a variable
number length, then a Number journal column of variable length will be created.
A new column is first added to the column list of the selected Document journal
object and is then inserted into a form using the Form – Insert Attributes menu item.
Availability of additional columns in the journal enables a user to get the most
important information about a document without opening it.
For any form elements displaying a journal column, the following attribute proper-
ties included in the column are applied automatically:
Password mode – if this mode is set for any attribute included in the column.
Format – in case of match for all attributes included in the column on all
languages specified in the configuration.
Tooltip – if tooltips match for all attributes, one tooltip is shown; if tooltips do
not match, they are shown separated by a comma.
Highlight negative – if this property is set for all the attributes included in the
column.
Multiline mode – if this property is set for all the attributes included in the
column.
5.11. ENUMERATIONS
An enumeration is a service data type that is mainly used with other data types
rather than independently. An enumeration is a list of possible attribute values.
Enumerations are used to enter document or catalog attributes and constant values
when it is necessary to enter only predefined information.
As an example, let us take the customer status concept. In the simplest case, there
may be retail and wholesale customers. Customer status usually influences the level
of discounts.
This list of statuses (Retail and Wholesale) is actually a simple enumeration.
When billing, the user has to specify the customer's status by selecting it from the
list. The selected customer status influences the sales price.
If the customer status is entered as an enumeration during task configuration,
a 1C:Enterprise configuration specialist may specify price calculation options
depending on the status.
First of all, when you use it, the enumeration cannot be expanded since the list of
its values was set during the enumeration setup.
All enumerations have only one level; no nesting is available.
The main feature of an enumeration is that its values are known and available
in the Designer. The configuration itself uses specific enumeration values.
1-302 1C:Enterprise 8.3. Developer Guide
With enumerations, you can limit the number of possible options, e.g. when
you enter a document attribute. Since enumeration value lists are created in the
configuration, you can validate the selected value and specify the actions that
should follow.
Use the Enumerations branch of the configuration tree to work with enumerations.
Editing an enumeration actually involves creating a list of values. To edit an
enumeration object, use the Enumeration object editing window. The Include in the
command interface property is disabled when a new enumeration is created.
Enter values for an enumeration at the Data tab.
NOTE
If several reports have the same default form specified as their main form, only
one report can be opened in the thick client (in a regular mode).
Since an external data processor (report) is not a part of the current configuration
(although it is closely linked to it), the procedure for saving it is different from
the procedure for saving configuration changes (see page 1-48). To save an external
data processor (report), use File – Save, File – Save As or File – Save Copy. In the
standard saving dialog box, select the External data processor (*.epf) (External
report (*.erf)) file type and enter the name for the external data processor (report).
...
1-306 1C:Enterprise 8.3. Developer Guide
// Connect the data processor to the server from the previously created
// temporary storage.
DataProcessorName = ExternalDataProcessors.Connect(TempStorageURL);
If you open a data processor (report) using File – Open, its form is opened with
the help of the OpenForm() method (with Uniqueness set to True); it ensures
a new data processor form can be opened in case of modifications.
A composite data type is usually used. This ensures you can specify the required
value when entering a specific characteristic. For example, the ProductChar-
acteristicTypes object of the chart of characteristic types is used to specify
extra dimension types for charts of accounts. This object has a composite type of
a characteristics value (see fig. 130).
Thus, when Chart of characteristic types objects are used to describe the structure
of a chart of accounts, extra dimension types will be selected from predefined list
of characteristic types. When a specific account is created, specify which extra
dimension types are linked with this account.
As the figure shows, account 30 Accounts receivable has two extra dimension
types – Company and Document – which are selected from a set of predefined
characteristic types specified in this chart of characteristic types.
To maintain accounts for a characteristic that has no description (catalog) in the
configuration, use the Additional characteristic values property of the chart of
characteristic types. For example, you need to maintain accounts by cost centers,
but the configuration does not contain an appropriate catalog. In this case you can
create a custom CostCenter characteristic type and specify that items of an addi-
tional catalog will be used as values for this characteristic type. Since this catalog
is subordinate to the chart of characteristic types, only catalog values subordinate
to the characteristic type may be selected. It means values of different types will
not be mixed.
IMPORTANT!
When primitive types (Number, String or Date) are selected in the Characteristic
value type property, specify the size or contents of the type in the value type
editing window so that this description covers all possible values. If fractional
parts are not specified for numeric types, you will not be able to enter fractional
numbers. Changes in the description of numeric data after a user has entered
values may result in data loss.
To create predefined items in the Chart of characteristic types object editing
window, click Predefined at the Other tab. The window for predefined items will
open.
Contractors Catalog
Description
Ref: Priborpostavka
All objects required to store characteristics have been described. Please note,
however, that Nomenclature and CharacteristicType dimensions are unrelated
in the system. Therefore, when you enter characteristic values the system ignores
the selected characteristic type; instead, it prompts you to fill in the field using all
types described in the chart of characteristic types.
Structure description for the information register has no information about logical
links between the fields that store characteristic types and values. In real-life solu-
tions this logical link can be quite complex. A characteristic type can be stored
in other objects and defined by a complex algorithm that depends on the subject
area. This is why a relationship between characteristic types and values are
configured by the configuration developer.
In this case you need to configure a relationship between characteristic type and
value in order to enter information register records.
To do this, set the Link by type property for the CharacteristicValue resource to
CharacteristicType.
Now, if a user changes the characteristic type and the existing value does not
match characteristic types for the selected value type, the value is cleared.
If you want to try this example out, you should make another minor change in the
configuration. Set the Master property for the Nomenclature dimension of the
NomenclatureCharacteristicTypes register. It removes characteristic data
when goods are deleted and displays the Open Information Register command
in the catalog navigation panel.
Now you can check if the characteristic storing procedure is fully implemented.
Open the Nomenclature catalog item, select the Nomenclature characteristics
hyperlink in the navigation panel and start entering characteristics for a specific
item. As you enter the characteristics, you can create new characteristic types and
select their value type.
The implemented solution has a major drawback. You have enabled entry of
primitive-type characteristics and reference types defined in the configura-
tion. This example uses a catalog of contractors to enter the main vendor.
It is obvious, however, that some properties need to have their values selected
from lists. On the other hand, lists of values for various properties are different.
Accordingly, you cannot select values for these properties from catalogs existing
in the configuration. In this example paper size is entered as a string. It would
be more convenient to select a value for this property from a list of available sizes;
however, you cannot create catalogs for each characteristic type in the configura-
tion, since catalogs are created at the configuration development stage, while new
characteristic types are entered as you use the application.
Charts of characteristic types can help you deal with this issue. You can use
a subordinate catalog to store values of characteristics that cannot be selected
from catalogs, enumerations and other content existing in the configuration.
Chapter 5. Configuration Objects 1-315
Contractors Catalog
Description
Priborpostavka
1-316 1C:Enterprise 8.3. Developer Guide
CharacteristicValues Catalog
Owner Code Description
Ref: Paper size 1 A3
Ref: Paper size 2 A4
Ref: Casing color 3 White
Ref: Casing color 4 Silver
You can use charts of characteristic types to enter characteristic types as you
work with the infobase. However, you can also create predefined characteristic
types in the configuration. You are recommended to create these types as values
corresponding to the operation logic of the configuration, rather than as default
characteristic types. An example could be a New Year discount percentage. If you
enter this characteristic for a product, the price calculation algorithm can use it to
define a selling price in the period preceding the New Year.
5.14. REGISTERS
1C:Enterprise registers are mainly used to store and process information about the
company's business or organizational activities.
Document and Catalog type infobase objects are used to store information about
actual objects of a subject area, such as employees, goods, material and currency.
Each database object corresponds to an actual object of a subject area.
Registers usually store information on changes in the status of objects or other
information that does not directly reflect subject-domain objects. For example,
registers can hold information on currency exchange rates or information on the
receipt and dispensing of merchandise.
A database object is independent of its attributes and has its own value. For
example, an employee may change their last name, passport number or any other
attribute. However, the employee will still be the same individual.
After you delete an object, you cannot create it again. Even if you make all of an
object's attributes the same as those of the deleted object, it will be a different
object. The system stores an internal object ID – a reference. A reference
is unique within the entire infobase. No two objects may have the same refer-
ence in the entire lifetime of the infobase. References of the deleted objects are
not assigned to new objects. Database object references may be stored in database
fields.
The information in registers is stored in records. Use of a register record depends
only on the data that are stored in this record. For example, a currency exchange
rate record does not represent anything material. It does not correspond to any
physical object. The only important factor is that it contains currency, a date
and the exchange rate set for this date. This record may be deleted and replaced
with the same record, but this will not affect the logic of the system. Accordingly,
Chapter 5. Configuration Objects 1-317
register records do not have references and references to register records may not
be stored in database fields.
This section describes information and accumulation registers. For information
about accounting registers see page 1-660; for information about calculation regis-
ters see page 1-668.
When you open a table like this, please keep in mind that the Rate column
contains specific exchange rates for a certain date and it is assumed the rate does
not change for all the following dates until the next rate is available. Therefore, to
obtain the exchange rate for an intermediate date, you should take the rate for the
closest previous date with a recorded exchange rate.
It is also necessary to remember that different values in the Currency column
mean that a parallel history of exchange rates is maintained for several currencies.
In other words, the table shown above can be represented in a different way:
Date USD Rate EUR Rate
31.10.2008 26.5430 35.0447
01.11.2008 27.0981 34.4092
02.11.2008 27.0793 34.4828
Chapter 5. Configuration Objects 1-319
Such a table may contain any number of columns, depending on the number of
currencies for which exchange rates need to be stored.
If a register is not periodical, no Period field is created for it. In the example
above, the CompetitorPrices register may be non-periodical if you do not want
to store the price change history (you only need the current prices). In this case
the register function can be used to tell us what a specific competitor's price is for
a specific good currently, but it will not be able to tell what the price was at the
beginning of the year.
These principles imply that the system can only have one record with a specific
set and period of dimensions. In fact, there really can be only one price for each
product of each competitor. If, for any reason, we can obtain multiple prices and
want to store this information in the database, we need to create another dimension
to store a value that makes these prices different. For example, you can create an
InformationSource dimension. In this case we will be able to enter competitors’
prices from different sources.
Uniqueness of the records in a dimension set makes information registers funda-
mentally different from accumulation registers where multiple records can be
entered with the same value and period.
If receiving data as of the very first moment or the most recent (current) moment
is the most frequent use of the register, then it makes sense, with regard to such
registers, to allow the system to support totals for the slice of the last data (Allow
totals: section of last property) or the slice of the first data (Allow totals: section of
first property). An example of such use is a register with the sales prices of goods.
The item price can change, but queries for the current price are the most common
queries to this register.
Information register totals will be used if all of the following prerequisites are met:
Totals use in the configuration is allowed for the register.
Totals use in 1C:Enterprise mode is allowed for the register.
Data as of the very first date (the slice of the first data) or the last (current) date
(the slice of the last data) is received without specifying the period value.
Conditions for the SliceFirst and SliceLast virtual tables are set only for
values of dimensions and separators that are in the Independent and Shared
mode.
Only dimensions and separators in the Independent and Shared mode are used
in data access restrictions.
If none of the above is met, the standard query is used to get the information from
the register.
1-320 1C:Enterprise 8.3. Developer Guide
Resources in an information register can have a wide variety of data types, while
other registers can only contain numeric resources.
For a description of how to create forms and templates see page 1-47.
No Empty Values. If this option is checked, register records cannot have empty
dimension values.
Index. This dimension property may be edited for non-master dimensions. For
dimensions, resources and attributes with the Index property turned on, a separate
index is created, thus increasing register performance. Index is always created for
master dimensions.
When a register is viewed in the 1C:Enterprise mode, you can sort register
records by indexed dimensions, resources and attributes. The required number of
forms for register viewing and editing has to be created at the configuration devel-
opment stage.
Ordering Information Register Dimension List
The arrangement of an information register's dimensions is very important.
If you need quick access to some dimensions, place them at the beginning of the
list.
The sequence of information register dimensions influences the possibility of using
1C:Enterprise script methods that employ positional access to dimensions.
You should also remember that changing the order of dimension requires restruc-
turing of the infobase.
It is hard to explain the physical meaning of an accumulation register, since it does
not have any material counterpart.
IMPORTANT!
Therefore, let us specify that an accumulation register is an n-dimensional system
of coordinates for storing joint data. The axes of such coordinate systems are
called register dimensions and the stored data are called register resources.
You can create any number of accumulation registers at the configuration develop-
ment stage. However, you should remember that if there are too many accumulation
registers, this might reduce system performance during document posting.
In addition to dimensions and resources, you can also create a set of attributes for
an accumulation register. Attributes may be used to add any information to register
records. Attributes do not influence values of register resources and may be used to
analyze register records.
You can see in the table that the Product dimension has the Table and Cabinet
values, while the Warehouse dimension has the Temporary, Wholesale and Retail
values. The Count and Total columns for the accumulation register's resources
contain the quantity and total value for each product at the warehouse.
Unlike register records, you cannot view totals of accumulation registers directly.
To obtain totals information, you can create any number of reports in the configu-
ration. These report will query the totals and display them as product reports,
warehouse cards, lists, etc.
When you edit an accumulation register, you specify its type and develop its struc-
ture:
Create sets of register dimensions, resources and attributes;
Create screen and print forms to view register records, if necessary.
NOTE
Such values as UUID, BinaryData, and any unlimited length string cannot be the
accumulation register dimension type.
This section describes unique properties of accumulation registers that supplement
common properties of all objects.
Register Type specifies if a register can be used:
To store balances (select Balance from the list),
To store turnovers (select Turnovers).
See page 1-325 for a description of the differences between the balance register
and the turnover register.
Default List Form. A register may contain several forms for tracking its records.
If there are multiple forms for entering and selection, you can specify the default
form in the Default List Form property.
Enable totals split. If this check box is set to True (default value), totals splitter
mechanism is used to ensure a greater concurrency of writing to the register. If
the system writes records in multiple concurrent sessions, it does not update the
same totals records; it writes each change in the totals as a separate record. To
obtain totals, these values are summed. This way, totals are kept up-to-date (this
is useful for quick generation of reports, for example) and register records can be
made concurrently. This mode requires more resources (for instance, the amount
of data in totals tables is bigger in this case). This is why both the configuration
and the 1C:Enterprise script contains properties that manage this mode.
Records multiply only when transactions are performed concurrently. Their
quantity for each combination of dimensions depends on the maximum number of
concurrent transactions. When recalculating totals, separate accumulated records
are collapsed.
The totals splitting mode can be modified by the user in the 1C:Enterprise mode.
By default this property is enabled.
Use in totals. If this check box is set to False, the dimension is excluded from the
stored register totals.
Several forms can be created to view the register records. If there are several forms
for data input and selection, you can specify the form to be used by default in the
Default List Form property.
1-328 1C:Enterprise 8.3. Developer Guide
Fig. 135. General Flowchart for Working with Aggregates (client/server variant)
○○ If the aggregate’s use mode is set to Auto, the aggregate will be enabled
based on performance evaluation. The use of this aggregate is evaluated
together with the aggregates automatically created by the system. If an
automatically created aggregate performs better than the aggregate created
in Designer with Auto use mode, an automatically created aggregate will
be used instead.
4. Aggregate updating must be completed afterwards (UpdateAggregates()
method). When aggregates are updated, data from the selected register records
table is moved to the corresponding aggregate tables. The records created
in the records table after the previous aggregate update are moved.
5. Next, the usage statistics of the aggregates created should be accumulated.
To do this, perform standard tasks that use data from the register for which the
aggregate mode has been enabled within a certain period of time (e.g., within 1
month). Regular aggregate updates must be performed while working. When the
period ends, rebuild the aggregates (step 3) and perform steps 3–5 on a regular
basis.
The described schema details an approach to working with the register’s aggregates
in a client/server mode.
Working with aggregates differs a little when it comes to file-based usage of the
system:
The major differences between this approach and a general approach to working
with aggregates (see fig. 137) is as follows (only the differences are described):
At step 1 a list of aggregates must be created in Designer.
Step 6. Recalculation of optimal aggregates (DetermineOptimalAggre-
gates() method) should be performed regularly (e.g., once a month). During
this period (1 month), standard tasks that use data from the register for which
the aggregate mode has been enabled should be performed. Regular aggregate
updates are needed while working.
Step 7. When a new list of optimal aggregates is received, the user needs to
define whether or not a list of aggregates needs to be changed in the configura-
tion metadata. If no changes are required, proceed to step 3.
Step 8. If a list of aggregates needs to be updated, load the required (or all)
aggregates (from a list of optimal ones). Update the database configuration (the
infobase will be restructured) and then proceed from step 3.
For guidelines on each of these steps, see the next section.
Rebuilding
You should rebuild aggregates at least as often as you calculate the list of optimal
aggregates. This operation does not modify the list of aggregates; instead,
it attempts to use the existing aggregates only.
You should also keep in mind that the rebuilding operation is only efficient if you
have a considerable amount of statistical data.
Although it is hard to recommend when you need to rebuild aggregates in the
most general case, major factors can be pointed out:
when it is probable the nature of register data has changed;
when it is possible the nature of queries has changed (which modifies the
accumulated statistics).
When you perform the operation, you are required to specify two parameters:
Maximum relative size – limits the size of the generated aggregate list
(percentage of the record table size). If it is set to zero, there is no limit on the
aggregate list size.
Minimum effect – percentage of improvement in the process of rebuilding the
older list. If the new list improves the effect by the specified value, the method
rebuilds the list. If the parameter has no value or is set to zero, there is no
minimum effect requirement.
The current list of aggregates is also rebuilt if its size exceeds the value in the
Maximum relative size, % parameter or the resulting list is at least as efficient as
the double value of the Minimum rebuild effect, % parameter. Otherwise the list of
aggregates is not rebuilt.
NOTE
The rebuilding operation takes a lot of time and resources. You are not recom-
mended to run this operation when other users actively use the infobase.
NOTE
You are recommended to run this operation when the load on the infobase
is minimal.
TIP
You are recommended to use the totals splitting mode when using aggregates,
especially if aggregates are updated by a scheduled job and at the same time
documents are posted for a register that updates the aggregates.
Use of aggregates
To define an aggregate to be used for a query, use the algorithm described below.
A query defines the register dimensions to be used, selects a list of aggregates that
contain all dimensions used and match the query by frequency and period the best.
Next, an aggregate with the minimum size is selected from the list. This is the
aggregate that will be used.
A query may use an aggregate with a lower frequency than the frequency set
in the query. In this case, the required data will be obtained by adding data from
shorter periods.
Sometimes a period specified in the query does not match the aggregates period.
In this case, two aggregates can be used to execute a query. Let us take a look at
an example. For instance, an infobase includes two aggregates that cover the entire
query period:
With monthly periodicity;
With daily periodicity.
The query is executed for the period from September 15 to November 15. In this
case, two aggregates will be used:
An aggregate with a monthly periodicity will be used to obtain data from
October 1 to October 31;
An aggregate with a daily periodicity will be used to obtain data from
September 15 to September 30 and from November 1 to November 15;
Data from the different aggregates will be added together to obtain the final
result.
A virtual turnover table of the register for which the aggregate mode is enabled
always contains actual data.
NOTE 2
This operation takes the longest time and the biggest amount of resources.
We strongly recommend running it only when other users do not work with the
infobase.
Aggregate Editing
You can only create and edit a list of aggregates for an accumulation turnover
register (the Register Type property is set to Turnovers). If you want to call the
aggregate wizard, use the Open aggregates command in the register context menu.
It opens the aggregate wizard window where you can manage aggregates of an
accumulation turnover register. You can manage aggregates manually or load
a ready-to-use list of optimal aggregates (use a special button at the command bar).
As you create aggregates, you can specify their use. If it's Auto (by default), the
system independently determines whether an aggregate needs to be used during the
aggregate rebuilding operation. If Always is selected, the system always uses this
aggregate.
The Periodicity column defines the minimum time period for storing totals for the
selected dimensions in the aggregate. You are allowed to have multiple aggregates
with identical dimension sets and differing periodicity. Be sure not to overuse
aggregates. A big number of aggregates can excessively expand the database
without increasing query performance.
You can use the right-hand area of the window to indicate dimensions to be
included in the edited aggregate. An aggregate can contain any number of dimen-
sions (up to 30) or have no dimensions. In this case summary turnovers for the
register are saved with the specified periodicity.
If the list of optimal aggregates is stored in an xml-file, you can load this list.
To do this, use a special command of the aggregate wizard (see fig. 139) and select
the ready-to-use list.
The system compares the list from the file with the current aggregate list and high-
lights the aggregates recommended to be added (from the Optimal Aggregates list)
and the aggregates recommended to be deleted (from the Aggregates list). You can
choose not to implement the recommendations or implement them partially.
COMMAND INTERFACE
Command Interface is the main tool that grants users access to the application
functionality and ensures navigation between forms and various actions. A configu-
ration developer does not create detailed descriptions of global interface commands
or form command bars for every single user role available in the application (or
for combinations of roles); instead, the developer describes the rules used by the
command interface to automatically create a user-specific view.
The command interface representation depends on the user's rights (see page
1-180), functional options of the application (page 1-211) and, finally, user settings.
A declarative description of the command interface helps match the user-specific
commands and the user's rights to perform certain actions; it also ensures the
command interface of the application can be modified if some application function-
alities are not implemented.
The above list of categories is a list of application interface areas where global
commands can be displayed.
The system provides standard command groups for global commands grouping.
Chapter 6. Command Interface 1-343
Besides, at the configuration development stage the developer can create custom
command groups (Common – Command groups configuration object, see page
1-230) that can be categorized into one of the categories listed above (Category
property of a command group). These groups, along with predefined groups, can
be used for displaying the developed custom commands.
6.2.1. Subsystems
The global command interface of the main application window is based on the
configuration's structure of subsystems. Subsystems are used as a basis of the
application functionality representation for users. The structure of subsystems
describes the overall system functionality. Since the global command interface of
the main application window depends on the structure of subsystems, the devel-
oper should exercise extra care when developing the configuration subsystems.
The structure of subsystems is, in fact, the first thing a user will see when opening
the application.
The structure of the command interface is affected by the subsystems marked as
Include in the command interface. However, this property is set for the subsystems
by default; therefore, it is assumed that the subsystems are primarily created to
describe the global command interface.
NOTE
If the configuration has no subsystems marked as Include in the command interface,
the sections panel is not displayed on the desktop in the main application win-
dow.
Top-level subsystems create application sections, i.e. sets of global commands in a
particular area. Sections are displayed in the sections panel of the main application
window. Selecting a specific section modifies the commands in the navigation and
actions panels.
Subsystems of lower levels create subsections in the navigation panel; these are
used to consolidate commands of a particular subsystem.
If an object belongs to a particular set of subsystems, its commands are displayed
in the corresponding areas of the configuration's command interface. However, by
default new objects do not belong to any subsystem. It means their commands are
not included in the command interface. Therefore, to add the object's standard and
custom commands to the right areas of the command interface, you need to specify
the subsystems owning the object.
An object can belong to multiple subsystems with no regard to their interdepend-
ency, i.e. it can belong to both a parent and a subordinate subsystem or to
a subordinate subsystem only if it is more convenient for the purpose of creating
the command interface.
NOTE
If the configuration has no subsystems marked as Include in the command interface,
the desktop displays all commands that could be added there manually. In this
case the command interface editor has a different appearance: it does not display
a tree of commands and cannot remove commands from the desktop.
As soon as the first subsystem is included in the command interface, automatic
placement of commands on the desktop is disabled and commands should be
added to the desktop explicitly.
NOTE
The mode of automatic command placement on the desktop is disabled if the
configuration run mode is Ordinary application.
6.2.2. Commands
As mentioned above, the system includes both standard commands and commands
a developer creates in the configuration.
You can create a Command configuration object as subordinate to the following
configuration objects:
catalogs
Chapter 6. Command Interface 1-345
documents
document journal
reports
data processors
charts of characteristic types
enumerations
charts of accounts
charts of calculation types
information registers
accumulation registers
accounting registers
calculation registers
business processes
tasks
exchange plans
filter criteria
Additionally you can create common commands (Common – Common сommands
branch in the configuration tree; see page 1-230).
The Command parameter type property defines a list of forms where this command
can be executed. For example, if the command's parameter type is Cata-
logRef.Goods, it can be executed in the following forms:
Form of Goods catalog item, where a reference to the edited object is used as
a parameter;
Form of Goods catalog list, where a reference from the current list row is used
as a parameter;
Form of a receipt, where a reference to a product from the current row of the
document's tabular section is used as a parameter, etc.
The number of values passed as parameter values to the command is defined by
the Parameter usage mode property. If this property is set to Single, the command
only receives a single value of the selected type.
1-346 1C:Enterprise 8.3. Developer Guide
If the property is set to Multiple, an array of values is always passed as a param-
eter (even if a single value is selected). This mode makes sense when data for
the command can originate from a table in the multiple selection mode. In this
case the array's first item is the current row (regardless of the selection order of the
table box rows). Thus, if a list of goods includes Mixer, Vacuum cleaner, Refrig-
erator, Kettle and Mixer, Refrigerator and Kettle are selected while the current row
is Refrigerator, the command receives an array with the following items (the order
of items is preserved): Refrigerator, Mixer, Kettle. The order of items after the first
item is undefined, even though they are ordered in the example above.
NOTE
If the current row is not a part of the selection, the first array item cannot be
identified unambiguously.
Areas of the forms' command interface are automatically created based on the
type of the main attribute. When a form is edited, a form developer can add
areas to the command interface. For example, if a form is used to edit goods, all
commands with the CatalogRef.Goods parameter type are automatically included
in it (e.g., Print product card, Go to product price list, etc.). If a product has the
Manufacturer attribute, commands with the CatalogRef.Contractor parameter
type can also be added to the form at the development stage (e.g., Contractor card,
Contractor agreements, etc.), as the form allows users to obtain values for param-
eters of these commands. Although these commands (that do not belong to the main
attribute) are not automatically included in the command interface, the developer
can add them to the interface through the form editor.
Although a group of parameterized global commands is not automatically added
to the command interface for a catalog group (Folder and item hierarchy hierarchy
type) or a hierarchical chart of characteristic types, the developer can include these
commands in the interface through the form editor.
Please keep in mind that by default global commands are not included in the
command interface for forms of hierarchical catalog groups and chart of character-
istic types groups. To make a global command available in the command interface
of this form, you need to place it there manually, through the form editor.
When you create a command interface, use text representations of configuration
objects and commands. By default, the system generates representations based on
the Synonym and Name properties. However, you can modify these representations.
To do this, use object and list representations. For details see page 1-250.
You can save the obtained link and use it subsequently to go to the required object.
Since these links are text-based, you can send them to other users, e.g. by e-mail.
For a description of link formats see page 2-1187. You cannot get links to tools
included in standard functions.
You are allowed to launch the web client and follow a link concurrently.
It requires an external link from the web or thin client connected to the infobase
through a Web server.
To obtain an external link, use the standard link retrieval command, ensuring,
however, than the External button is selected in the link retrieval window (see fig.
142). The resulting link can be inserted into the browser address bar to load the
application and follow the link (the example on fig. 142 opens the Sales Order list
form).
NOTE
When Microsoft Internet Explorer is used, the application will not be launched
with simultaneous navigation to a link if the link is related to the application
already loaded in the current browser window. It is recommended to enter the
link in the address bar of a new empty Web browser window.
1-350 1C:Enterprise 8.3. Developer Guide
If a method call has no Explanation parameter, the URL becomes unavailable. For
the user to be able to follow the hyperlink, both NavigationLink and Explanation
parameters should be specified.
The notification window fades automatically after some time. However, if you
move the mouse cursor over this window, it is displayed until you close it delib-
erately or move the cursor away from the notification window area.
If the notification display method is called multiple times, the user only see the last
notification.
NOTE
The notification window is shown on top of all the windows of the current
application apart from modal windows. Modal windows are displayed on top of
a notification window.
When displayed in the favorites and history panel, the list of notifications
is aligned to the right side of the panel. The latest notification is displayed to
the right of the panel. If there are more than five notifications, only the last five
messages are displayed.
NOTE
The list of notifications is only displayed during the session lifetime.
Notification windows displayed in the web client are docked to the currently active
window.
Chapter 6. Command Interface 1-351
When you close the window where the notification window appears, the latter is then
displayed in the parent window, etc. until it reaches the main application window.
NOTE
You cannot move or re-size the notification window in the web client.
If you want to display the progress of the process in a progress bar (e.g., if you
know the total number of employees in the calculation and want to show how
many have been processed), use the same State() method and specify the third
1-352 1C:Enterprise 8.3. Developer Guide
parameter that defines an absolute value of the progress bar. The minimum value
of the progress bar is always 0 and its maximum value is 100.
State("Processing data",
Counter*10,
"Processing chunk: " + Counter,
PictureLib.SubsystemTradeInventory);
If the third parameter is not specified for the method, the progress bar is not
displayed in the status bar. In this case the explanation text is placed below the
text of the main description:
State("Posting for" +
Format(PostingDate, "DLF=DD"),
,
"Posted" + PostedCount,
PictureLib.Post);
The status bar automatically hides some time after a program fragment that
displays the bar stops running. However, if you move the mouse cursor over this
window, it is displayed until you close it deliberately or move the cursor away
from the status bar area.
NOTE
The status bar is shown on top of all windows of the current application apart
from modal windows. Modal windows are displayed on top of the status bar.
In the web client a status bar is displayed as a separate Web browser window.
This window is updated in the following ways:
Microsoft Internet Explorer. The status is updated every time you call the
State() method.
Mozilla Firefox. The state is updated upon each call to the server and after the
program code in the 1C:Enterprise script is executed. Therefore, if no server
methods are called during execution of the program code in the 1C:Enterprise
script, the status bar is not updated.
Google Chrome and Safari. Status is updated only when built-in code execution
is finished.
Chapter 6. Command Interface 1-353
6.3.4. Messages
Most messages in an application are logically related to data. For example, if you
post a document while certain items are missing at the warehouse, the programmer
has to notify the user of this event.
Messages allow the developer to create notifications that specify object attributes
causing the error. When displayed in a client application, a message can be
automatically docked to a form element used to edit the attribute; in this case
it is displayed next to the control.
Messages are displayed on the message panel in the lower part of the work area.
The height of the message panel does not exceed 5 lines. If the panel contains
multiple messages, a scroll bar appears, but the panel does not increase in height.
Nor can the height be changed manually.
This mechanism is based on the UserMessage object of the platform.
Messages are used to notify a user that the requested action has failed (e.g.,
a document cannot be posted because the inventory balance is not available).
1-354 1C:Enterprise 8.3. Developer Guide
If a message is linked to a tabular section field, changing the tabular section row
order will not affect message visualization.
If the row linked to the message is deleted, the message will be linked to a form
element (see page 1-402) displaying the tabular section.
In case the message is linked to a table row linked to the FormDataCollectio,
FormDataTree or FormDataStructureAndCollection type form attribute, the
interactive search is performed by user (using a corresponding standard command)
with the result of hiding the string, for which the message was created, then the
search operation will be automatically aborted and the message will be shown as
required. If a program filtering is set for the table (the RowFilter property), this
filter will not be cancelled when the message is shown and the message is posi-
tioned for the whole table.
Chapter 6. Command Interface 1-355
NOTE
You are recommended to display messages to notify a user the requested action
cannot be completed, rather than to inform him/her of the actions in progress.
In the latter case you can use the ShowUserNotification() method instead.
If you want to associate an error message with the correct form element, the system
needs to know the following: the attribute, the owner infobase object and the form
element used to display the attribute. Filling in the properties listed above helps
you answer all of the questions:
Set the DataPath property to specify the form attribute that stores the infobase
object data.
Set the Field property to specify the object's attribute for which the message
will be displayed. Thus we can say that the message will indicate DataPath.
Field data that are identified with the DataKey value. This allows the system
to define the form element that displays the required information based on the
form structure data. Later, this form element is used to display the message.
The Field property can contain a description of the data in the following
format:
○○ For attributes, the AttributeName type string, for example, Vendor, Vendor.
Parent.
○○ For tabular section attributes, TabularSectionName[RowIndex].Attribute-
Name; e.g., Nomenclature[10].Count.
○○ For recordset rows, [RowIndex].AttributeName; e.g., [10].Currency.
The AssignmentID property specifies which form a message is linked to. For
example, if a message is generated in a form shown on the desktop, setting
the AssignmentID property will show a message linked to the form where the
messaged was generated.
If the DataKey property is filled in the message and does not match the key value of
the current form main attribute (object reference or information register record key):
A new object form, corresponding to the DataKey value, opens;
If the DataPath property is not set in the message, it is filled in with the
main attribute name of the open object form;
The message is displayed in the new form.
Additionally all messages where the DataKey value matches the value of this
property in the current message are moved from the current form to the new form.
In this case the DataPath property is also filled in these messages if not set.
To fill in a data path, the system uses a special mechanism that saves informa-
tion about form elements matching objects and then uses it when the SetData()
method is called. Therefore, before object module procedures that create messages
can be executed, form attributes should be mapped to objects, while the developer
needs to call the SetData() method within the module.
1-356 1C:Enterprise 8.3. Developer Guide
When you perform standard actions with an object in a form, e.g., when you post
a document, the form extension creates and maps the object. In this case the
developer does not have to take any actions.
NOTE
If user messages were generated in a transaction when a new object was written
(exchange plan, catalog, document, account chart element, characteristic types
object element, calculation types list element, business process, job), when the
transaction is cancelled in messages, references to the object are cleared (the
DataKey property).
The following section describes how you can do the mapping if the object
is created programmatically based on form data.
You can map an object to a form explicitly, using a method or implicitly.
If you want to use explicit mapping, call the SetObjectAndFormAttributeCon-
formity() method. Information about the form where the object is displayed (the
FormID property) and which attribute stores the data object (the Attribute prop-
erty) is passed as a second parameter to the method to set the required mapping of
messages and form elements:
Parameters = New Structure;
Parameters.Insert("FormID", UUID);
Parameters.Insert("Attribute", "Object");
SetObjectAndFormConformity(Object, Parameters);
The mapping will exist for as long as the object for which it is set exists.
This method maps form attributes to data objects which ensures messages are
correctly mapped to the form elements. For a message to use data on mappings
between an object and an attribute name, link the message to the data using the
SetData() method of the UserMessage object.
ObjectCatalog = CatalogRef.GetObject();
Parameters = New Structure;
Parameters.Insert("FormID", FormID);
Parameters.Insert("Attribute", "Object");
SetObjectAndFormConformity(ObjectCatalog, Parameters);
ObjectCatalog.FillCheck();
If a passed object has an attribute mapping, the attribute name is returned by the
function. Additionally the mapping can be set by the form using the FormAttrib-
uteToValue() method. In most cases you are recommended to use this method.
// Code in document module.
&AtServer
Procedure Posting()
...
Message = New UserMessage();
Message.Text = "Row 10 of tabular section " + "Nomenclature lacks " + MissingNumber + " " + NomenclatureUOM;
Message.Field = "Nomenclature[10].Count";
Message.SetData(ThisObject);
Message.Message();
and move the command to the Important group. The Warehouse section is left
unchanged, with the command at its default location.
Finally, review the default command visibility. The form of the Shipment docu-
ment now contains a command used to navigate to a list of Inventory register
records; however, by default the command is hidden. Assume this command
is important to the system administrator and is irrelevant by default to a manager.
To implement this, create a form of the Shipment document, start editing the
command interface and make the command used to navigate to the register list
visible for the Administrator role; do not change the settings for the manager role.
Since the system administrator is granted broad access rights, the number of
commands is very big. Assume he/she will rarely use the command to go to a list
of invoices. To lighten the command interface, start editing the commands in the
All Subsystems editor and make the relevant command invisible for the Adminis-
trator role.
You can also display a command that adds a Shipment document in the actions
panel for a sales manager, so that he/she could enter this document without
opening the document list.
The user can also customize command visibility while working with the configura-
tion.
1-360 1C:Enterprise 8.3. Developer Guide
Chapter 7
FORMS
Forms are objects created for entering and viewing information and for managing
various processes. The program uses forms to ask the user for information it needs
to continue processing or to display information the user can view and edit.
The main purpose of a form is to provide the user with a convenient tool for
entering and viewing data. As in paper documents, you can use forms to quickly
enter the necessary information and to store it for later processing and when neces-
sary, to restore the previously entered data for viewing or editing.s
The visible part of a form (displayed to users) is a tree with form elements.
The items can include text boxes, check boxes, radio buttons, buttons, etc. More-
over, an item can be a group consisting of other items. A group can be represented
as a panel with borders, a panel with pages (tabs), a page or a command bar. An
item can also represent a table containing other items (columns). A structure of
items describes how a form looks like. All form functionalities are described by
attributes and commands. Attributes are data used in a form, while commands are
actions it performs. Therefore, a developer has to include the relevant attributes
and commands in the form through the form editor, create form elements to display
them and group these elements, if necessary.
TIP
We recommend designing forms with the resolution set to 96 DPI.
The system can auto-generate forms for application objects; however, the devel-
oper can create a custom form and define its attributes, commands and displayed
items. This logical description is used by the system to auto-generate the form as
it is displayed to users. The system checks various properties of the displayed
data (e.g., types) in the process in order to arrange form elements in the most
user-friendly way. The developer can change the location of items through various
settings. He/she can define the order of items, specify their width and height. This,
however, is additional information that helps the system display the form.
1-362 1C:Enterprise 8.3. Developer Guide
Within forms the developer can use both form commands and global commands
used in the command interface of the entire configuration. Moreover, he/she can
create parameterized commands that open other forms based on the specific data
from the current form. For example, one of these commands can open an inventory
balances report for the warehouse currently selected in an invoice form.
Forms support linking messages displayed to the user to form data. It means the
system can visually mark and activate the form elements that contain user-made
errors.
Forms also automatically account for role-based data availability. Thus, if an
attribute of a displayed object cannot be viewed by a specific user, the system
automatically removes the corresponding form element and rebuilds the form.
You can create forms in the form editor that is available in the Designer mode
(see page 2-937). This editor defines the following objects:
Form attributes that store data used in the form (see page 1-362).
Form parameters that link forms to each other and manage a form's function-
ality on opening (see page 1-384).
Form commands that perform various factions within a form (see page 1-388).
Form module that stores program code associated with form operation (see
page 1-390).
Form elements that display form attributes and make them editable and can be
used to display and execute commands (see page 1-391).
Command interface that contains commands which can be executed in a form
and are provided by the global command interface and form commands (see
page 1-421).
IMPORTANT!
Forms exist both on the server and at the client concurrently. You should always
keep it in mind as you develop forms.
erties (for details see page 2-942). You can also customize an attribute availability
in the form using functional options (for details on functional options page 1-211).
You can assign the Main attribute to a form, i.e. the attribute that defines the form's
standard functionality (the form's extension).
IMPORTANT!
Please keep in mind a form cannot have more than one main attribute.
Form extension describes additional properties, methods and parameters for
a ManagedForm object form; they are determined by the type of the form's main
item.
IMPORTANT!
When server procedures and functions are called and control is given back to the
client, only changes in form data are transferred. If the Arbitrary type is selected
as the form attribute type and the mutable value is selected as the attribute value,
you need to assign the mutable value to the form attribute after the mutable value
is changed, so data can be correctly transferred between the client and the server.
An application object can be represented by a single or multiple form data items.
Generally, the hierarchy and make-up of form data depends on the complexity and
interrelation of the form's application objects.
For example, a document that includes a tabular section is represented by the
FormDataStructure object (the document proper) with a subordinate FormDa-
taCollection object (the document's tabular section).
IMPORTANT!
As you develop the configuration, please keep in mind that application objects
are only available on the server, while form data objects can be used both on the
server and at the client.
When form attributes are created, the following limitations apply:
You are not allowed to assign Array and Map values to form attributes.
You are not allowed to assign Array and Map values to arbitrary-type attributes
of FormDataStructure, FormDataCollectionItem, FormDataTreeItem
and FormDataStructureAndCollection objects.
You are not recommended to use Array and Map values as items of Structure
or ValueList collections.
In the above cases you are recommended to use fixed collections: FixedArray,
FixedMap.
You are not recommended to use Structure or ValueList types in form
attribute data (i.e. attributes of attributes).
Form data can be viewed as a standardized presentation of data from various
application objects that the form uses identically and that exist both on the server
and at the client. In other words, the form contains a view of application object
data represented as its data types and converts these types as necessary. However,
Chapter 7. Forms 1-365
If the form data contain an invalid type (e.g., an attribute of the form attribute), the
form attribute editor displays the (Not available in form data) label next to the type
name of this attribute. In the 1C:Enterprise mode the form field corresponding to
this attribute is not created. No error messages are displayed in this case. You need
to explicitly implement the program code that supports copying and processing of
such attributes in the form when you copy or edit objects containing such data.
Let us review form attributes of different types:
Form attributes of ValueTable and ValueTree types allow you to add columns
(the Add attribute column command). It defines the data structure of the created
collection.
Attributes of FormDataCollection (e.g., objects' tabular sections) and
FormDataStructureAndCollection types (e.g., register record sets) allow
you to set additional attribute columns (the Add attribute column command) that
are not associated with the data stored in the infobase.
The system generates these columns when it creates the form data. You can call
these attributes both at the client and on the server.
Below is an example of how you can fill in an attribute column unrelated to data:
&AtServer
Procedure OnReadAtServer(CurrentObject)
EndProcedure
Attributes of the ValueList type allows you to set the value type (the Value
type property) to be stored in the list. In this case the system automatically
limits the type of data to be added interactively. Programmatic addition is also
allowed, but the system attempts to convert the value of the added type to the
limiting type (or the composite type). You can also associate the Value type
property with a form element. It enables you to limit the type of data that can
be added to the value list interactively.
Attributes of the DynamicList type allow you to set list parameters: main table,
settings, etc. For details see page 1-369.
IMPORTANT!
Attribute columns that are not associated with data are excluded from data con-
versions between form data and infobase objects.
For a description of the View and Edit properties see page 2-942.
Chapter 7. Forms 1-367
Form data changes are displayed by form elements after execution of the
1C:Enterprise script or a forced call of the RefreshDataRepresentation()
method. Consider the following example.
Assume a form contains a Counter attribute of the Number type. This attribute
is displayed in the form as a field of the Progress bar type. Assume you have
an action you want to be tracked in the progress bar. This action is triggered by
clicking a button in the form:
Procedure FormCommandHandler()
ExecuteAction();
EndDo
EndProcedure
If you click the button that initiates this command in the 1C:Enterprise mode, the
progress bar indicator is first in its leftmost position and then it moves directly
to the rightmost position (assuming the ExecuteAction() method has been
operating for some time allowing to see the change in the progress bar). In other
words, the progress bar is only updated after the command handler completes its
work.
For the progress bar to display the real progress of the process, you have to replace
the handler code with the following:
Procedure FormCommandHandler()
ExecuteAction();
RefreshDataRepresentation();
EndDo
EndProcedure
After this modification the progress bar will change in the course of command
handler's code execution.
NOTE
In the web client, calling the RefreshDataRepresenation() method will
refresh form elements only when built-in code execution is completed.
1-368 1C:Enterprise 8.3. Developer Guide
ObjectProduct = Goods.FindByDescription("Coffeepot").GetObject();
ValueToFormData(ObjectProduct, Object);
EndProcedure
&AtClient
Procedure Write()
WriteAtServer();
EndProcedure
&AtServer
Procedure WriteAtServer()
EndProcedure
Chapter 7. Forms 1-369
When creating a DynamicList form attribute the developer can generate the data
query using one of two methods:
Setting the main table – in this case it is sufficient to specify the table (the
Main table property) that has to be used as a data source; in this case the system
will auto-generate the data query (see the right part of fig. 149);
Generating the query manually – by setting the Custom query property (see the
left part of fig. 149). After this you can manually format the query that retrieves
data from the infobase.
The query can retrieve data from multiple tables; therefore, you can indicate the
main table. It is required so the dynamic list knows which data are primary and
which are secondary, so it can select and display information correctly and provide
standard commands. However, defining the main table in the query is optional;
in this case the dynamic list will have no commands related to the main table.
If you select manual query formatting, the following limitations apply:
The dynamic list does not support batch queries.
The dynamic list does not support unions in a query if the main table is speci-
fied.
The dynamic list does not support grouping, sorting and filtering by attributes
of tabular sections.
The dynamic list may not contain ORDER BY sections if the main table is speci-
fied. In this case you should use queries without the main table or set the
required ordering using the dynamic list settings.
Chapter 7. Forms 1-371
You cannot use subquery fields that return multiple values in a query. Use
queries without the main table.
The query may not contain groupings and aggregate functions if the main table
is specified. In this case you should use queries without the main table or set
the required groupings using the dynamic list settings.
If the dynamic list is displayed as a hierarchical list or tree, the query may not
contain filters by its parent.
If a dynamic list is shown as a hierarchical list or a tree, the query should
be generated in such a way that query results will contain elements and their
parents.
The dynamic list does not support sorting if the query contain aggregate func-
tions.
If the main table is specified in the dynamic list, the query may not include
TOP and DISTINCT instructions.
If the arbitrary query is specified, the query should not include the TOP instruc-
tion.
Specifying a dynamic list table used in the query only in an external connec-
tion as a main table.
It is not recommended that you use table joins inside the FROM block of the
dynamic list query if such joins are specified using the extension of the data
composition system query language (in squiggle brackets). We recommend
overwriting the query so as to get rid of such joins.
Make sure that you consider the following when creating a dynamic list:
You cannot specify tabular sections of objects in the main table of a dynamic
list.
You cannot use change registration tables (used in data exchange mechanisms),
sequence tables and recalculation tables (used in periodic calculation mecha-
nisms).
If the query specified for the dynamic list does not ensure uniqueness of the
selected strings, the strings in the list and scrolling will be incorrect. In this
case you have to disable use of the main table.
In other words, a dynamic list with a specified main table will only work
correctly if the query specified as a data source does not increase the number of
rows received from the main table (with applied filter).
In this case you must disable use of the main table.
When dynamic list properties are modified programmatically, any command
bars associated with the dynamic list are not updated automatically.
The interactive list setup is not available for a dynamic list showing enumera-
tion lists.
If a list form assumes filtering of linked data (for example, filter by owner in a
subordinate catalog list), a dynamic list generation query should include a field
1-372 1C:Enterprise 8.3. Developer Guide
with a reference to the parent object. This field should have the name of the
corresponding standard attribute: Owner, Parent, BusinessProcess, etc. If this
requirement is not fulfilled, the standard command for switching to any subordi-
nate list will work, but filtering will not be set. If for any reason it is impossible to
fulfill the requirement, you should not use standard commands and instead imple-
ment your own commands to open such lists.
If a dynamic list displays data sourced from a virtual table (the Main table
property, see page 1-441), for which the BeginOfPeriod and EndOfPeriod
parameters are set, these specified period borders are inserted directly into the
parameters of a virtual table when a user sets the display period using the Set date
range command).
You can use an array or a list of values as a parameter of the dynamic list. But if
a list of values is a parameter, only the first list value will be used as a filter value.
If a dynamic list uses a query with parameters, initial setting of the parameter
values should be done in the OnCreateAtServer handler.
If the dynamic list is the main form attribute, you can set filter values for it using
the form's Filter parameter (for details on form parameters see page 1-384).
In this case the structure's property name stored in the Filter parameter should
march the filter field name in the dynamic list. If these names match, the value of
the structure property is set as the right value of the filter item. If an array, a fixed
array or a value list is passed as the value for the Filter parameter item of the
dynamic list form, a condition with the In list option is added to the filter; the right
value of the condition is placed in the value list (which results from conversion of
an array or a fixed array).
A query using a parameter to generate any field value can be used as a custom
query in a dynamic list, for example:
SELECT
CASE
WHEN Delivery.Rate = 1
THEN &Presentation
ELSE Delivery. Rate
END AS Rate
FROM
Document.ProductDelivery AS Delivery
If the parameter value type is different from the object attribute type, (e.g.,
Attribute1 has the Number type and parameter value has the String type), you
should explicitly cast the parameter value to the required type to correctly display
the field:
SELECT
CASE
WHEN Delivery.Rate = 1
THEN CAST(&Presentation AS String(100))
Chapter 7. Forms 1-373
If the field used in the filter is disabled with the help of functional options, the
filter is not set, even if the filter value is passed as a form parameter or a selec-
tion parameter link.
The Read data dynamically property specifies if data for the dynamic list have to
be read by small chunks. Regardless of this setting, the following conditions apply:
If you set the hierarchical list view, the system reads data from the current
folder only.
If you set the tree view, the system reads data from the open tree nodes only.
Simultaneously loading a dynamic list data is not supported if the hierarchical
view is set (the Display property is set to Tree or Hierarchical list) and initial
tree representation set to Expand all levels. To obtain the data, the server will be
queried for the number of times that there are nodes in the list displayed.
To get displayed data dynamic lists use one of these three methods:
1. Data are read from a database by chunks where the data item count is equal
to the number of rows shown by the list simultaneously. Server-side caching
is not used.
2. Data are read from the database in 1000-data-item chunks. Server-side caching
is used.
3. Data are read from the database in chunks. The first chunk contains 1000
items. Each subsequent chunk is increased by 1000 items (when the previous
selection reaches its end). The closer the "view point" moves to the end of the
displayed data sequence, the bigger the selection that is read from the database
is; eventually, it becomes as large as the size of the data displayed. Server-side
caching is used.
Different data reading methods are used based on what the dynamic list main table
selects and what the value of the Read data dynamically property is:
One of the following tables is specified as the value of the Main table property:
the exchange plan, catalog, document list, document journal, chart of character-
istic types, chart of accounts, chart of calculation types, business process, job or
business process point table:
○○ A key identifying the table row: Reference.
○○ The Read data dynamically property is set: method 1 is used (see the
description above).
○○ The Read data dynamically property is not set: method 2 is used (see the
description above).
One of the following tables is specified as the value of the Main table property:
the main table of the information register, accumulation register, accounting
1-374 1C:Enterprise 8.3. Developer Guide
Mask
Multi-line mode flag
Extended edit flag
Password mode
When you display and edit filters or parameter of the data composition system, edit
format of the relevant field is applied.
List setup property: Click the Open hyperlink to open the display settings form
for the dynamic list. Setting up the list is similar to other operations in the data
composition system.
Setting up the dynamic list in the configuration, the developer can do the following:
Specify the fields to order by;
Describe the list filtering;
Specify conditional appearance settings;
Specify the fields for grouping the data.
The developer must specify the sort settings if the default sorting set up by the
system is not acceptable.
TIP
Please keep in mind that an inappropriate selection of the sorting fields (as well
as fields of data filtering and grouping) negatively affects efficiency of dynamic
selection.
IMPORTANT!
Sorting and grouping by fields that contain strings of unlimited length is not
allowed.
1-376 1C:Enterprise 8.3. Developer Guide
From the point of view of the application developer, dynamic list settings consist
of several interrelated parts. The main property to be used to manage dynamic list
settings is SettingsComposer. This object contains three sets of settings that
define the final system settings applied to the dynamic list:
Settings – settings created in Designer mode.
UserSettings – are settings changed by the user in 1C:Enterprise mode.
FixedSettings – are settings set programmatically by means of the script.
Filter values transferred to the form via its parameters are also included in this
property. The Filter, Order, Parameters, and ConditionalAppear-
ance dynamic list properties provide easy access to the fixed settings of the
dynamic list settings composer. In other words, these requests are identical:
List.SettingsComposer.FixedSettings.Filter and List.Filter.
When a final setting of the dynamic list is created, different variants of the settings
are combined as follows:
If a certain type of settings is marked in full as a custom set, the resulting
settings will contain these custom settings (List.SettingsComposer.
UserSettings). If any items of the settings are marked as unavailable, these
settings will be added to the resulting settings from the List.SettingsCom-
poser.Settings property.
If a certain type of settings is marked as a custom type on a by-element basis:
□□ Items marked as custom itemss will be added to the resulting settings
from the List.SettingsComposer.UserSettings property.
□□ Items marked as unavailable will be added to the resulting settings from
the List.SettingsComposer.Settings property.
Fixed settings (List.SettingsComposer.FixedSettings) are added to
the resulting settings as is. Fixed and user settings cannot have settings with
the same names, i.e. a filter with a similar left value in the condition.
Whether or no settings are available to the user is controlled in the dynamic list
settings window (see fig. 151).
An option in the lower part of the window (see fig. 151) controls the layout of the
entire settings view in the settings area (standard or quick). This option is available
for the purposes of filtering, ordering, grouping, and conditional formatting. If settings
are specified in the Quick access editing mode, specify an empty group of the form
where the elements connected to the quick user settings of a dynamic list will be
located, in the List setup property of a form table that displays the dynamic list. If the
group is not set, quick user settings will not be displayed in the form. You can also
explicitly initiate the creation of user settings with the help of a script by using the
CreateFormControlsOfUserSettings() method for dynamic list expansion.
Furthermore, you can enable the placing of specific settings elements in user
settings. This option is available for filter items and conditional formatting
(see fig. 151).
Chapter 7. Forms 1-377
There are two ways to enforce the downloading of special settings when a dynamic
list is opened:
With the help of a parameter of a UserSettings dynamic list form. The data
contained in this parameter will be added to the dynamic list’s user settings.
With the help of a parameter of a UserSettingsKey dynamic list form. If
this parameter is specified when a form is opened, the user settings from the
settings storage with the specified key will be loaded to a dynamic list (which
is the form’s main attribute).
Fill сheck: Defines whether the attribute has to be checked for completeness (the
property value is Display error). You can perform fill checks for the following
attribute types only:
Primitive data types (Number, String, Boolean, Date, any reference types and
a standard period)
List of values
Value tree
Value table
NOTE
Attribute fill checking is similar to the ValueIsFilled() function. In tabular
section fill checking a tabular section is filled if it contains at least one row.
Unfilled mark: It sets incomplete value marks and can be applied to the
following:
○○ form elements: text box, table
○○ table fields: text box
TIP
If the Unfilled mark property is managed via the conditional appearance, set the
Automark unfilled property of the field processed to No.
Text: It is used to specify the text and can be applied to table fields (label
fields and text boxes).
Format: It changes the value output format can be applied to the following:
○○ form elements: group of Page type, group of Regular group type,
○○ table fields: label field and text box.
Visibility – this is used only to disable rendering of table fields: the label
field, text box, switch field and picture box. The location of cells with disabled
rendering is allocated by changing the size of adjacent cells. The cell stretching
algorithm can be different in different client applications.
Accessibility – this is used only to disable the availability of table fields: the
label field, text box, switch field and picture box.
Read Only – this is used only to enable View only mode for table fields: label
field, text box, switch field, picture box.
Show – this is used only to disable rendering of table fields: the label field, text
box, switch field and picture box.
NOTE
Conditional appearance uses the current date of the computer adjusted to the time
zone of the 1C:Enterprise session. For details on time zones see page 1-292.
If conditional appearance is used to format a form table, the current table data
containing the column is used when the condition is calculated. If the formatted
field does not belong to the table, first table form (in the order specified in the form
editor) data are used to calculate the condition.
You can use conditional appearance to specify certain appearance types for form
elements depending on the values of the form attributes; in this case form appear-
ance is dynamic, i.e. changes in form data are tracked. You do not need to perform
any special actions to modify the form's appearance.
Consider an example of this type of appearance.
Assume you need to highlight rows in a tabular section of a Goods Issue docu-
ment if the count in these rows is less than 10.
To do this, you need to set the following conditions in the form's conditional
appearance:
Conditional appearance type: text color. Select a custom color.
1-380 1C:Enterprise 8.3. Developer Guide
For the resulting view of the conditional appearance, see fig. 153.
As you can see, the font color in the first row of the tabular section is now red,
because the count of goods in this row is below 10.
However, in some cases you cannot highlight the entire row with a special color;
instead, you need to highlight the tabular section cell than contains the count.
To do this, change the previous conditional appearance: select the Quantity field as
the formatted field instead of the entire Goods tabular section.
In this case a single field is highlighted (see fig. 154).
Please note that you can also use values of columns that are not associated with the
infobase data in conditional expressions.
Chapter 7. Forms 1-381
You can use tabs to set and get a selection or cursor position in the editor or to
add or delete text items in a document.
When the selection start position and end position match, it means that there is no
selection and cursor position is received. The same goes for setting the selec-
tion: if the selection start and end match, the cursor position is changed with no
selection. You should also remember that if the text selected is changed program-
matically, the selection is not cancelled. The selection keeps the positions which
were set before the text was changed programmatically.
An example of getting and setting the selection in the formatted document editor
is given below:
// Content – form attribute of FormattedDocument type
// Editor – form item of Formatted document type
// Begin – attribute forms of Number type. Specifies the position of the start selection.
// Finish – attribute forms of Number type. Specifies the position of the end of the selection.
&AtClient
Procedure GetSelection()
StartPosition = 0;
EndPosition = 0;
Items.Editor.GetTextSelectionBounds(StartPosition,EndPosition);
Beginning = Content.GetBookmarkPosition(StartPosition);
Finish = Content.GetBookmarkPosition(EndPosition);
EndProcedure
&AtClient
Procedure SetSelection()
StartPosition = Content.GetPositionBookmark(Beginning);
EndPosition = Content.GetPositionBookmark(Finish);
Items.Editor.SetTextSelectionBounds(StartPosition,EndPosition);
EndProcedure
When delete operations are used, the tab describing the start of the fragment being
deleted may be incorrect. If you need to keep the deleted fragment's starting point,
use the fragment start position. Thus an example of replacing selected text with
another text will look as follows:
Procedure InsertStringAtCurrentPosition(Editor, Content, String)
Var Beginning, End;
Editor.GetTextSelectionBounds(Beginning, End);
Position = Content.GetBookmarkPosition(Beginning);
Content.Delete(Beginning, End);
Beginning = Content.GetPositionBookmark(Position);
Chapter 7. Forms 1-383
Content.Insert(Beginning, String);
Editor.SetTextSelectionBounds(Bookmark, Bookmark);
EndProcedure
It could be useful to process items of a formatted document that is a part of the
paragraph if you need to delete all formatting such as italics or the bold font.
Example:
Bold = New Font(, , True);
Italic = New Font(, , , True);
Normal = New Font;
For each Item From Paragraph.Items Do
If TypeOf(Item) = Type("FormattedDocumentLinefeed") Then
Continue;
EndIf;
If Item.Font = Bold OR Item.Font = Italic Then
Item.Font = Normal;
EndIf;
EndDo;
1-384 1C:Enterprise 8.3. Developer Guide
The GetItems() and GenerateItems() methods can also help in working with
a text. These methods return the array of formatted document items. To understand
the difference between these methods, look at a formatted sample document with
the string: 012 456 890. The string consists of 10 characters with "5" and "7"
characters replaced with spaces. Items located between positions 2 and 9 in the
document must be obtained.
BeginPosition = Document.GetPositionBookmark(2);
EndPosition = Document.GetPositionBookmark(9);
Result = Document.GetItems(BeginPosition, EndPosition);
For each Item From Result Do
Message("Text – " + Item.Text);
EndDo;
These methods differ in that the GetItems() method returns all the items detected
between specified bookmarks (including all border items), i.e. in the example
considered the following text will be displayed:
Text – 012 456 890
And if the GenerateItems() method is applied, the result will be as follows:
Text – 2 456 8
In other words, when you apply the GenerateItems() method, the system gener-
ates a set of items in such a way as to include only the content of the formatted
document located between the bookmarks.
Please note that the GenerateItems() method changes the formatted document at
the time of the call, and if (in the given example) the GetItems() method is called
again after the GenerateItems() method, the result will be as follows:
Text – 2 456 8
You get this result even if no changes have been made to the set of items received
after calling GenerateItems().
of the form's unique key. When you attempt to open a form, the system searches
the right form using the generated unique key. If the form with the obtained
unique key exists in the system, it is the one to be returned; otherwise a new
form is created.
When you call a form, you can specify values of the parameters created by
a developer in the parameter structure along with the form's system parameters (if
any).
The form's parameters can be passed to the form when it is created. The passed
parameters can be analyzed in the OnCreateAtServer() event (the Parameters
collection is a property of the ManagedForm object):
EndProcedure
IMPORTANT!
After you call the OnCreateAtServer event handler all the non-key parameters
of the form are removed from the Parameters collection.
TIP
The form's non-key parameters required in further work should be saved in the
form data.
can also use these parameters in the 1C:Enterprise script by passing them when
calling the OpenForm() method.
For a list of standard form parameters depending on the form extension type, see
section Script – Interface (managed) – Managed form – …extension… of the built-
in help.
StandardProcessing = False;
EndProcedure
Chapter 7. Forms 1-387
Special attention should be paid to the third parameter of the OpenForm() method.
This parameter determines the owner of the selection form that will get notifica-
tions of the selection made. In the above example the selection form owner is the
form element; however, you can also specify the form in this parameter. In this
case you need to implement the ChoiceProcessing handler of the form module
and use it to decide what form attribute to use to store the selected data.
NOTE
If the StartChoice event handler is not implemented, the system performs its
actions instead. The same is true for all the other handlers used in the example
above.
Now you need to process the passed parameters in the selection form. You can do
this in the OnCreateAtServer() handler of the selection form module:
&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
StandardProcessing = False;
Items.List.ChoiceFoldersAndItems = Parameters.ChoiceFoldersAndItems;
Items.List.AllowRootSelection = Parameters.AllowRootSelection;
Items.List.CurrentRow = Parameters.CurrentRow;
CloseOnSelection = Parameters.CloseAfterSelection;
EndProcedure
To check whether the specified form parameters are valid, set the ChoiceFolder-
sAndItems property to Folders for the selection form's List table (catalog item
selection is unavailable without the parameter).
NOTE
If the SelectionMode property is not set to True for the List table that displays
the list of goods, product selection is unavailable.
Now you need to process selection of the required item in the selection form.
To do this, define the ValueChoice event handler for the form table:
&AtClient
Procedure ListValueChoice(Item, StandardProcessing,Value)
StandardProcessing = False;
NotifySelection(Value);
EndProcedure
Finally, you need to process item selection in the text box. To do this, you need to
process the ChoiceProcessing event for the SelectedProduct text box.
1-388 1C:Enterprise 8.3. Developer Guide
&AtClient
Procedure SelectedProductChoiceProcessing(Item, ValueSelected, StandardProcessing)
StandardProcessing = False;
Object.SelectedProduct = ValueSelected;
EndProcedure
Now you have implemented the system mechanism of value selection in the form
text box.
IMPORTANT!
This example is not complete. It only demonstrates how to work with form
parameters.
When creating parameters (SelectedGoodStartChoice() handler), you can
replace the following string:
ChoiceParameters.Insert("CloseAfterSelection", True);
In this case the selection form will not close after you make the selection. For
example, you can use this string to implement a multiple-selection form (when you
need to select multiple products without closing the selection form).
Commands provided by the global command interface (the Global commands tab)
can be located anywhere in the form, just as the form commands.
The Action property specifies the handler that implements the action of the
command. If no handler is set, the command is unavailable. You can only select
client-side procedures and functions without parameters in this field (for details
see page 1-390).
If the command modifies the form data, you should specify it in the Modifies
saved data property. When you attempt to execute the command, the following will
occur:
An attempt to block the linked form attribute is made. Where the attempt fails,
the command will not be executed.
The change flag for the form (the Modified flag) is set.
If the command property is set to Saved data and the form is in the View only
mode, all form items connected with this command will have the status View only.
In addition, when a global parametrized command whose parameter is provided
by an attribute with the property set to Save data is executed for a new unsaved
object, the execution will result in an attempt to write the object. In this case the
user will be asked whether writing is necessary. If the answer is no, the command
will not be executed.
NOTE
If command bars and context menus with the specified command source are filled
in automatically, standard commands are not added if the item has buttons with
the same commands added manually. This logic does not apply to the commands
added from a fragment of the global command interface.
To facilitate development of various dialogs, standard form commands include
Yes, No, OK, Cancel, Retry, Abort and Ignore. If a command of this type is added
to the form, clicking the button does the following:
If the form is opened in the modal mode, it is closed and a value of the
DialogReturnCode type is returned;
If the form is opened in the non-modal mode, it is only closed.
The command's Name property is used to generate a name for the command
execution handler.
Use: For details see page 2-942.
Functional options: Defines what functional options are associated with this form
attribute. For details on functional options page 1-211.
1-390 1C:Enterprise 8.3. Developer Guide
You are not allowed to use multiple compiler directives before a single method or
variable. You are not allowed to have multiple methods or variables with the same
names differing only in compiler directives.
Form command handlers created by the developer can only be included in the
client-side methods of a form module.
In the form module, you are recommended to use preprocessor directives within
procedures and functions only.
NOTE
To understand the possible results in case when the preprocessor instructions
cross the procedure boundaries, you should take into account that the preproces-
sor instructions are processed before compiler directives.
For a complete list of compiler directives and preprocessor instructions, see page
1-157.
Review the following example of using compiler directives:
&AtServer
Var ServerSideVariable;
&AtClient
Var ClientSideVariable;
&AtServer
Procedure ServerSide()
Message(ServerSideVariable);
EndProcedure
&AtClient
Procedure Command1Execute()
Message(ClientSideVariable);
ServerSide();
EndProcedure
form table
form button
form groups
Form fields and tables are always associated with the form data. If the associated
attribute is not specified, is unavailable at the client due to right restrictions or
is excluded from the set of attributes (the View and Edit properties of the form
attributes), the field is not displayed in the form and is automatically removed
when the form is created in the execution mode.
skipped when pressing Enter (but it will be available when pressing the Tab key
or pointing to it with the mouse). If the property is set to No, the item will not
be skipped when you press Enter. There is also the option to specify automatic
skipping of form elements. For this you need to set the property to Auto. In this
case the following algorithm is used:
The Field type element will be skipped if it is a label field or a picture box,
depending on the Display warnings during editing property (see page 1-400).
The Button element will not be skipped if it is a default button.
The Decoration element will be skipped.
The Table element will not be skipped.
(the field type can be both Label field and Text box) to the required location in the
hierarchy and select Contractors[3].Debt (in the Attribute selection dialog) as
data for this field. Here Contractors stands for an attribute of the (ValueTable)
type, and Debt is a column of the value table.
If these fields reference to a missing row, they cannot be edited even when a text
box is selected, otherwise any change made in the text box will also be made
in the table to which the text box provides the reference.
In the example above, if the user changes the text box, the value from this text box
is passed to the Debt column of Row 4 in the Contractors value table.
Attribute Association Through Reference
If the form data have reference-type attributes (e.g., CatalogRef), a form element
can be associated with the attribute retrieved using the reference. Data for these
elements are automatically retrieved and updated whenever the reference modifies.
Attribute association through reference can have any level of nesting. Elements
associated with this type of attributes are always View only.
NOTE
Attribute retrieval through references is not allowed for composite-type attributes
(including CatalogRef, DocumentRef, etc.).
Assume you need to add a field that displays the article for the current product
row to the form. To do this, insert a Label field in the appropriate location in the
elements hierarchy and select Object.Goods.Product.Article as the field
data (in the Attribute selection dialog box). Here, Object is a form's Document
attribute for a specific type, Goods is the document's tabular section, Product
is the tabular section's attribute and Article is an attribute of the Goods catalog.
Association with Collection Totals
An element can be associated with attributes representing the collection's totals: the
tabular sections, recordsets and list of values (only the number of rows in a collec-
tion). These attributes can include:
Totals for the numerical fields;
Row count in the collection.
Elements associated with this type of attributes are always View only.
As an example, add a field that displays totals for the Goods tabular section to the
form. To do this, select Object.Goods.TotalsSum as the form field data, where
Objectis the form's main attribute, Goods is the document tabular section and
TotalsSum is a special attribute. In addition to the element associations, other
association types are allowed, too. You can set associations to display data in a
table footer or tab header (Page type groups).
Depending on the type of data displayed by the form element (text box, button or
group), you can use the Type property to specify the data display method.
Chapter 7. Forms 1-395
If a picture is selected in the Designer, you can use another option of selecting
a file on the hard drive (an external picture). You are only recommended to use
pictures of this type when you develop external reports or data processors that can
be used in various configurations and the picture is a meaningful formatting item;
in other cases using these pictures is undesirable. You cannot select an external
picture for form commands and global commands.
7.5.2. Form
It describes the form's visual properties. Element of this type is always unique;
it is located in the element hierarchy root. The form properties also describe
handlers of form events.
The form opening mode is controlled by a special property: Window open mode.
This property defines how the window is opened:
Independent: The form opens in a non-modal window that represents an auxil-
iary application window:
○○ Forms in separate windows. A form is opened in a non-modal window
which is the application’s auxiliary window.
○○ Forms in tabs. A form is opened in a separate tab.
○○ Taxi. The form is opened in the work area of the main application window.
Lock parent window: The form opens in a non-modal window, but this mode
locks operations with the form used to open the current form. This mode
is intended for the forms that are used for short periods of time and do not
require a lot of data to be entered, e.g. forms for entering items in catalogs with
a small number of attributes. This mode is similar to the modal form opening
mode; however, when you open a module from the 1C:Enterprise script, the
module operation is not interrupted while you are using the opened form. All
other actions with the form are identical to the operations with non-modal
forms. In this case the form is also opened in an auxiliary window.
If you open a form in this mode, it is not included in the search of forms
that have already been opened. If you try to open an identical form (even if the
unique parameter is set to False), the form opened in the Lock parent window
mode will not be found and a new form will be displayed.
This mode is set by default for the following forms:
○○ Catalog item and folder
○○ Exchange plan node
○○ Item and folder of a chart of characteristic types
○○ Account
○○ Calculation type
○○ Task
○○ Record of an independent information register
Chapter 7. Forms 1-397
Lock the entire interface – similar to the form that is opened in the Lock parent
window mode, but in this case one is blocked from working with the parent
form and the full interface of the application. This mode for opening is not
used as a default setting.
The following algorithm is used to define the locked window when you open
a form in the lock mode:
If the FormOwner property specifies a form which is not closed, the form
window is locked;
If the FormOwner property specifies a form element in a form and the form
is not closed, the owner form window is locked;
In other cases (if the FormOwner property is Undefined or the owner form
is closed) the current window of the client application is locked.
The Window opening mode property does not affect the way a form opens if the
modal mode is used or if the form is opened in an existing main or auxiliary
window.
For a description of automatic title generation see page 2-1195.
The Vertical scrolling form property determines how form elements will behave if
the form is collapsed vertically. If the property is set to Use or Auto (determined
for a specific form as Use), a vertical scroll bar is visible after the vertical size
of form elements reaches the size specified when the form was edited in Designer
(this refers to the elements whose height is also determined automatically). If
a property is set to UseIfNecessary, the form elements will shrink vertically to
their minimal size before a scroll bar appears.
For instance, there is a form with the attribute List of type DynamicList.
This attribute is shown in the form as table List, for which the height is set to
8 table lines. If the form’s Vertical scrolling property is set to Use, the form will
hardly decrease in size at all:
In this case, the vertical scroll bar appeared almost immediately after an attempt
was made to vertically shrink the form.
If the form’s Vertical scrolling property is set to UseIfNecessary, the form will
first shrink vertically to its minimum, and then a vertical scroll bar appears.
1-398 1C:Enterprise 8.3. Developer Guide
If the property is set to Auto, the form’s behavior is defined by the system based
on the type of the main form attribute:
If the main attribute of the form is of type DynamicList or of type Repor-
tObject, and the ReportResult property is specified for the report form
extension, Auto is treated as UseIfNecessary;
In all other cases Auto is treated as Use.
You can display a command bar for a form (you can use the Command bar posi-
tion property to manage the bar location in the form). The set of standard form
commands is managed using the form's Command set property.
If the Enable form change property is off, the user cannot change the make-up and
relative position of form elements in the 1C:Enterprise mode.
The Check fill automatically property checks how form data are filled. For details on
the fill check see page 1-270.
If the form Save form data in the settings property is set to Use list, the Save
column becomes available in the attribute list. The attributes with the Save prop-
erty set to True are saved in the form data storage (for details see page 1-223).
In this case the system uses either the storage from the form's Settings repository
property or the storage from the configuration's Form data settings storage property.
NOTE
You can't check the Save checkbox for object tabular sections.
You can make the form View only using its ReadOnly property which can only be
changed programmatically. If this property is set to True, the following standard
commands become unavailable (including the cases when you try to invoke them
using the keyboard shortcuts):
For all forms:
○○ Restore settings
For table boxes:
○○ Add
○○ Copy
○○ Delete
Chapter 7. Forms 1-399
Generate commands
For object form extensions, information register records and constants:
○○ Write
○○ Write and Close
○○ Post
○○ Post and Close
○○ Clear posting
○○ Activate
○○ Completed
For selection form/settings extensions:
○○ Finish editing
○○ Select settings
For table box extensions in dynamic lists:
○○ Mark for deletion
○○ Post
○○ Clear posting
○○ Create group
○○ Move to folder
For table box extensions in value lists:
○○ Edit
○○ Move up
○○ Move down
○○ Sort descending
○○ Sort ascending
○○ Pickup
For all the commands that modify the following collections of the data compo-
sition system:
○○ Settings collections
○○ Collections of available fields
For table box extensions for FormDataCollection, FormDataTree, FormDa-
taStructureAndCollection:
○○ Edit
○○ Move up
○○ Move down
○○ Sort descending
○○ Sort ascending
Form element associated with these commands are also unavailable.
1-400 1C:Enterprise 8.3. Developer Guide
If the form is Read Only and its main attribute is a dynamic list, all tables asso-
ciated with the list also become read-only. Moreover, if the Folder List property
is filled, the form element indicated in this property also becomes read-only.
However, the View only property of the form elements remains unchanged.
7.5.3. Field
The Field form element is used to display and edit a form attribute. A form field
can have one of the following types:
Text box
Label field
Check box field
Image field
Radio buttons
Text document field
Spreadsheet document field
Calendar field
Progress bar field
Track bar field
Chart field
Gantt chart field
Dendrogram field
Flowchart field
Geographical schema field
HTML document field
If the field is subordinate to a Table form element, it can be assigned the
following types:
Input field
Picture field
Label field
Check box field
If you insert a Radio buttons field, you should specify the form element Selec-
tion list property that defines the number and contents of values for radio buttons.
By default radio buttons are positioned horizontally. If you want to arrange them
vertically, change the value of the Column count property.
You can specify a viewing type for fields like Checkbox and Radio buttons.
Use the Check box type property of the corresponding form element to do this. You
can select a checkbox view or a toggle switch view for the checkbox field.
Chapter 7. Forms 1-401
Fig. 157 shows different variants for representing the checkbox field. The upper
part of the picture shows the checkbox field as a toggle switch, and the lower part
as a checkbox. You can select a radio button view or a toggle switch view for the
checkbox field.
Fig. 158 shows different variants for representing the radio button field. The upper
part of the picture shows the radio button field as a toggle switch, and the lower
one – as a radio button.
If you want to add a text box to the form (available field types: spreadsheet docu-
ment field, chart field, Gantt chart field, dendrogram field, graphical schema field,
geographical schema field), you have to create an appropriate form attribute and set
it as the form element data.
If you want to add an HTML document field to the form, you have to create
a String-type attribute and an HTML document field and set the generated attribute
as the field data. You can use a URL or HTML document text as a value for the
form attribute.
NOTE
Please note that some HTML functionalities may not be supported if an HTML
document field is used. In particular, this includes status scripts (variables that
store values required in different event handlers), the parentWindow property of
an HTML document, and any work done with SVG markup language.
If you want to place a formatted document field on the form, you have to create
a FormattedDocument-type form attribute, create a Field of formatted document-
type text box and set the generated attribute as the field's data.
NOTE
You can work with the GeographicalSchema attribute on the server only.
If you use the form text box to edit an auto-filled attribute that can be filled manu-
ally (in rare cases), you can implement this behavior using the text box Display
warnings during editing and Warnings during editing properties. If the Display
warnings during editing property is set to Show and you attempt to edit the field,
1-402 1C:Enterprise 8.3. Developer Guide
1C:Enterprise displays a warning with the string that is specified in the Warnings
during editing property or auto-generated.
If the AutoMarkIncomplete property of the input field is set to False,
its MarkIncomplete property will be automatically actualized when a value
is transferred from an attribute to the input field.
For the standard Code and Number fields (for objects with auto-numbering), the
auto-generated string is Number filled automatically when writing, while for other
fields it is Edit field Field Name not recommended.
If the Display warnings during editing property is set to Auto, the standard Code and
Number attributes will use the Show value, while other fields will use Do not show.
The Display warnings during editing property also affects the text box Skip on input
property. When the Skip on input property is set to Auto, the field is skipped on
input if the Display warnings during editing property is set to Show (or Auto for the
standard Code and Number fields).
You can use one of two methods to edit the form's StandardPeriod
or StandardBeginningDate attributes:
Use a single form field that will be added to the form and directly associated
with the edited attribute. In this case all editing is performed in this field.
Use multiple fields. You can add fields associated with the attribute properties
to the form. In this case a developer can independently implement the required
logic of interaction between the standard period option and date values.
The property of the Entry suggestion text box allows you to specify a tooltip to be
generated just "inside" the text box provided that the following prerequisites are met:
The linked attribute type is neither Number nor Date.
The linked attribute value does not include a default value for this type.
The input focus is not on this text box.
7.5.4. Decoration
Decoration represents an appearance form element. It is not associated with data
(form attributes). It can be a label or a picture.
TIP
You are recommended to use decorations for constant text explanations. If text
can be modified programmatically, it is recommended to represent it as a label
field.
7.5.5. Table
The Table form element visualizes table data. It can be represented as a dynamic
list, tabular section, value list, etc.
The position of the table command bar is managed in the Command bar position
form element. The set of standard commands in the table command bar is defined
Chapter 7. Forms 1-403
the following property values are modified in all the form tables associated with
the form's main attribute (of the DynamicList type):
The ShowRoot property is set to True;
The AllowRootChoice property is set to True;
The Representation property is set to Tree.
If a table displays a hierarchical list with a set picture row, this set picture will be
ignored for table rows displaying groups and the standard group picture will always
be shown.
NOTE
If a table displays a dynamic list (see page 1-369) and the Initial tree display
property is set to Expand all levels, only a list of rows shown on the first level
will be received when a form is created on the server, and then when the form
is opened the rest of the rows displayed will be received. A separate server query
will be run for every group displayed.
When forms are being designed, certain situations can arise when you need to stop
scrolling some columns in a table. For example, you need to lock the Number,
Nomenclature and Sum columns in a tabular section.
You also need to align Number and Nomenclature to the left side of the table, and
align Sum to the right side of the table.
FixedInTable properties are used for this operation. This property is available for
a field located in the table and for Column group-type groups (see page 1-406).
In this example, we need to set the FixedInTable property to Left for the Number
and Nomenclature columns, and to Left for the Sum column. The columns will be
aligned with the corresponding side of the table regardless of their location in the
form editor. But these fixed columns are shown in the order in which they are
located in the editor.
If the alignment attribute is set for a group, the whole group will be aligned (with
all the subordinate form elements) and the FixedInTable property value for any
subordinate items will be ignored. If the alignment attribute is set for a column
included in a group with the FixedInTable property set to No, the column will be
processed as a separate column not included in a group.
The Search when typing property is used to determine how the system handles
character input from the keyboard, if a table is the active item and direct keyboard
input is not available:
Auto – in this case the search window is opened for the table linked to the
dynamic list, for other tables the search window is not opened.
Use – the search window is opened for any type of attribute linked to the table.
Do not use – the search window is not opened for any type of attribute linked
to the table.
Chapter 7. Forms 1-405
7.5.6. Button
Each command in a form is displayed by the Button form element. A button can
be displayed in the command bar or the form itself. If the button is displayed
in the form, it can be represented as a hyperlink (use the Type property to change
the setting).
Use the Command property to specify the command invoked by clicking the button.
If the Only in "All actions" property is set, it means by default the button is added
to the More (All actions) menu; however, the user can add the button to the bar
using a special editor.
7.5.7. Group
When developing a form, you can group items in various ways. You can group
fields, form pages, commands or columns.
The form can contain groups of controls. These can be groups of fields, pages or
commands. You can also create groups of columns for Table elements.
You can create the following groups in the editor:
Regular group is used to group form elements. It can be formatted in various
ways:
○○ None – the group is not highlighted in any special way;
○○ Light marking – the group’s header is displayed in a large green font;
○○ Normal marking – the group’s header is displayed in a large green font;
Indents are placed around group elements (on either side);
○○ Strong marking – the group’s header is displayed in a large green font;
A green line is placed on the left (for the entire height of the group).
An indent is placed at the bottom.
A regular group can be setup to enable the user (in 1C:Enterprise mode) to
collapse or expand such a group. For instance, you can use such a collaps-
ible group to place information that is not important in terms of the regular
form use but may be required every once in a while for data review and
analysis.
Group behavior (regular or collapsible) is defined via property Behavior.
The initial group state is defined by the Collapsed checkbox. A group cannot
be collapsed or expanded if it does not display a header or if the header
is empty. The application developer cannot determine the current group state
from the script. She or he cannot forcibly collapse or expand a group.
Use a special image or a hyperlink to control the group’s state (collapsed
or expanded). To specify the element that controls the group’s state, use the
Display mode control property. You can also specify the title of the group
(the Collapsed title property) to be displayed if the group is collapsed.
1-406 1C:Enterprise 8.3. Developer Guide
2. Buttons of the command interface if it is enabled for the command source.
3. Custom commands added to the group.
4. Commands of the More (All actions) menu (for a command bar only).
5. The Help command is the last to be displayed (if it is provided by the
command source).
If the above auto-ordering of buttons in a group is unacceptable, you can use the
following options:
Disable the Autofill check box for the form's command bar, context menu or
command bar of the element and add the required commands manually (in the
appropriate order);
Disable the command source of the command bar, add the required commands
manually (in the appropriate order), then add a Button group and specify
a command source for the group;
You can manually position a button associated with a standard command from
the command source in the required location of the command bar. In this case
the command in question is not automatically added to the command bar.
If you add a Group-type element in the element's context menu and specify
another element as a command source for this group, the group added will be
populated with commands (in 1C:Enterprise mode) based on the same rules that
are applied for the element's context menu selected as the command source.
You can add custom commands created in the command editor to all of the above
listed command bars.
If you want to add commands located in the form command bar (see page 1-89) to
another command bar, do the following:
Add a Group – Command bar item to the command bar;
Select this group as the Global commands of the form commands bar source.
If the command bar or the context menu that contains the group with the Global
commands of the form commands bar source also includes a group with the
Form command source and you fill in this group, the commands from the form's
command interface are not added to the group.
The element display order is defined by their order at the Elements tab of the
form editor.
The form size (and form elements size) can be limited in the Width and Height
properties (or the Height in table rows property).
If element placement results in exceeding the specified form size, scroll bars
are used.
If the displayed element is a group, element placement rules within the group
are identical to those within the form.
Although this algorithm is simple, the developer can modify it using multiple
methods and improve the form's readability:
form elements groups
form elements sizes
child elements width
Below each of the options is described in more detail.
IMPORTANT!
When you place form elements in the form, both the main placement rules and
the additional rules covered below are applied.
Left narrow: The correlation of the left and right item widths is 2:3.
Left narrowest: The correlation of the left and right item widths is 1:2.
Review the following example.
Assume you want to have two columns in the document header. One of them (to
the left) should include the Buyer and Warehouse attributes, while the other (to
the right) should include the Price type and Settlement currency attributes. Since
the left-side column is more important, you want to increase its width.
To do this, create a Header group and set the Horizontal grouping type. Create
two more groups inside the first group: Left and Right. Each group is assigned the
Vertical grouping type. Add the Buyer and Warehouse attribute to the Left group
and the PriceType and Currency – to the Right group.
After that set the Width of subordinate elements property of the Header group to
Left widest.
NOTE
The main purpose of the Width of subordinate elements property is to specify the
dimensions to be used when the platform generates the form.
Data area standard width specifies the data area width and has the following
properties:
is determined by attribute data type linked to the form element or by the Width
property of the form control
does not depend on the Stretch horizontally property of the form element.
Fig. 164. Data area width is less than default data area width
In the example shown in the fig. 164 the data width becomes less than default
data area width.
Alignment will stop working when the first element title line is extended.
The Name field data area width should be less than default data area width, if
alignment was applied. This proportion adds one letter i to the title.
1-414 1C:Enterprise 8.3. Developer Guide
The title width will not be significantly larger than the maximum value of
default data area width and this field's title width:
In the example shown in fig. 165, alignment stops working when the second
element title line expands in such a way that the First name, patronimyc, last
name field title width becomes significantly larger than the default data area width.
This proportion changes when patronymic is added to the title.
If it is impossible to determine single title width for several vertically positioned
elements based on the above rules, the system will define element sets inside which
the conditions are met. Grouping into sets does not depend on element vertical
order. Grouping starts with the control with the least width. Elements in one set do
not necessarily follow each other.
If there is an element for which alignment is not applicable between the
elements, it does not affect the alignment.
For a checkbox, displayed data are a rectangular area where the checkbox
is shown.
Nested Groups
If form elements (with titles to the left) are located in a Regular group-type group,
elements will be aligned along with border elements only if the Display property for
the group is set to None. Otherwise, alignment of elements in the group will not
consider elements around the group.
Fig. 171. Stretching element to the right until delimiter is reached
2. Nested form elements with the Stretch horizontally property set to Yes (or Auto
for some elements) also change the position of their right border if the parent
form element size changes.
3. If there are other elements that can be changed to the right of the element, the
element is relocated until a restriction from p.1 is applied for the rightmost
element (the form element "pushes" its right-side neighbors).
Chapter 7. Forms 1-417
4. If the property Stretch horizontally is set to Yes for two or more adjacent
elements, when parent element horizontal size changes these elements adjust
their width simultaneously and proportionally.
In the example in fig. 174, the Cancel button between decorations does not
change its size, since it does not have the Stretch horizontally property.
2. Nested form elements with the Stretch vertically property set to Yes (or Auto for
some elements) also change the position of their lower border if the parent form
element size changes.
3. If there are other elements that can be changed under the element, the element
is relocated until a restriction from p.1 is applied for the lowest element (the
form element "pushes" its lower side neighbors). This situation is shown
in fig. 176 (the Warehouse element).
Chapter 7. Forms 1-419
Either a single approach or mixed model can be used for an application. A special
configuration property is used to control such functionality – Modality usage mode
(see page 1-169).
The first approach to modality usage (modal windows) includes the use of special
types of OS windows, i.e. modal windows. If this schema is used, script code
execution stops until the modal form is closed. A return value will be received
directly where the modal form was opened, and any actions using this value can be
performed immediately afterwards (with the same method): analyzing, part of an
algorithm, etc. Modal windows can be opened with the help of OpenFormModal()
or Warning() methods. However, modal windows are not supported on iPads and
are poorly supported in a web client.
In these cases, we recommend that blocking windows be used. A blocking window
differs from the modal window as follows: when a blocking window is opened,
script code execution goes on. A callback procedure is used to obtain the result of
the blocking window’s operations. This peculiarity results in the fact that an algo-
rithm that uses modal calls to control its work will have to be completely reworked
to be used with blocking windows. The difference between the two ways of using
modal windows, from the point of view of the developer, is shown in the example
below. For example, there is a certain client handler that asks the user a question
and performs one or another application code branch, depending on the response
received.
Modal windows (example):
&OnClient
Procedure ExecuteAlgorithm()
Result = Question ("Execute fast or not slow?", DialogModeQuestion.YesNo);
If Result = DialogReturnCode.Yes Then
// First variant of the algorithm
Else
// Second variant of the algorithm
EndIf;
EndProcedure
In this mode (modal windows) script execution will stop at the Result = Ques-
tion() line and will continue only after the user responds to the question.
&OnClient
Procedure ExecuteAlgorithmCallback(Result, AdditionalParameters) Export
If Result = DialogReturnCode.Yes Then
// First variant of the algorithm
Chapter 7. Forms 1-423
Else
// Second variant of the algorithm
EndIf;
EndProcedure
In this example (where blocking windows are used), an algorithm is divided into
two parts:
A place where a question to the user is displayed
A place where the user’s response is processed
However, these are different fragments of the application code. When
the ShowQuestion() method is called, script code execution does not stop.
However, the user will be able to answer the question only when the script code
execution is completed and control is transferred to 1C:Enterprise. That means,
the results of a user using an open form cannot be obtained in the point where the
method displaying the question form was called.
When the user answers the question, an export procedure will be called. The appli-
cation developer should transfer the description to the blocking window opening
method. The NotifyDescription object is used to describe a callback method.
A callback method may be located in a form module, a command module, or
a common module. If you need to specify that a callback method and blocking
window call method are in the same module, use the ThisObject value. Also, you
can transfer different auxiliary data to the callback handler. This data will be avail-
able in the handler via a formal parameter, AdditionalParameters. These may
be input data for the algorithm operations, different parameters, etc.
As a rule, after any method that is used for working with blocking windows
is called, the method that contains such a call shall be completed with immediate
effect, and the rest of code shall be placed in a notification handler.
If a cascade call of callback methods is required, use the ExecuteNoti-
fyProcessing() method. This method can also be used if an action may be
implemented immediately before or after a prompt concerning actions to be taken
is displayed. For instance, if you try to reread a data file, the current state of the
editor is checked, and if the data in the editor has been changed, the system asks
whether it should reread the data.
Example:
&OnClient
Procedure RereadData(Command)
Callback = New NotifyDescription ("RereadDataEnd", ThisObject, FileDataName);
If Modified Then
ShowQuestion (Callback, "Data modified. Reread?" QuestionDialogMode.YesNo);
Else
ExecuteNotifyProcessing(Callback, DialogReturnCode.Yes);
EndIf;
EndProcedure
1-424 1C:Enterprise 8.3. Developer Guide
&OnClient
Procedure RereadDataEnd(Result, FileName) Export
If Result = DialogReturnCode.Yes Then
// perform data read
Modified = False;
EndIf;
EndProcedure
&OnClient
Procedure BeforeClose(Refusal, StandardProcessing)
If ResponseBeforeClose <> True Then
Refusal = True;
Callback = New NotificationDescription ("BeforeCloseEnd", ThisObject);
ShowQuestion(Callback, "CloseForm?", QuestionDialogMode.YesNo);
EndIf;
EndProcedure
&OnClient
Procedure BeforeCloseEnd(Result, AdditionalParameters) Export
If Result = DialogReturnCode.Yes Then
ResponseBeforeClose = True;
Close();
Else
ResponseBeforeClose = Undefined;
EndIf;
EndProcedure
Example 2:
// Open a modal form and after it closes
// access the form attributes
Form = GetForm("CommonForm.PeriodSelection");
Result = Form.DoModal();
If Result = DialogReturnCode.Yes Then
BeginDate = Form.BeginDate;
EndDate = Form.EndDate;
EndIf;
But it will not be called if you try to open the form as follows:
OpenForm("Catalog.Goods.Form.ItemForm");
Let's look at the example with different catalog item forms in more detail.
When the form is opened, the View attribute of the Nomenclature catalog
is analyzed. If this property is equal to Enumeration.ProductTypes.Service,
open the ServiceForm form of the Nomenclature catalog.
Procedure FormGetProcessing(FormType, Parameters, SelectedForm, AdditionalInformation, StandardProcessing)
If FormType = "ObjectForm" And Parameters.Key.Type = Enums.GoodsTypes.Service Then
SelectedForm = Metadata.Catalogs.Goods.Forms.ServiceForm;
StandardProcessing = False;
EndIf;
EndProcedure
This handler should be placed in the Nomenclature catalog manager module.
NOTE
The FormReceiveProcessing handler is not called if you try to open common
forms, constant forms, settings storage forms, external reports and external pro-
cessings.
1-428 1C:Enterprise 8.3. Developer Guide
Please note how ReadOnly, Enabled and Visible properties are specified for
elements with child items. Setting the property for the parent elements affects
all the child form elements. However, the value of the modified property in the
element does not change. In other words, the actual value of the ReadOnly,
Enabled and Visible properties for a specific form element is defined based on
AND concatenation of values for these properties of all the element parents.
Assume a DocumentCurrency folder contains Currency and ExchangeRate
text boxes. If you want to make the entire group unavailable, you can use the
following code:
Elements.DocumentCurrency.Enabled = False;
TIP
When you modify form elements properties programmatically, please avoid
unjustified modification of the properties that have the following message
in the Syntax Assistant: Calling the server is required on client property modification.
It slows down form performance and requires extra requests to the server.
NOTE
If changing a form element changes the control location in the form (e.g., when
form control visibility is modified), different event handlers can be called related
to element activation (e.g., the OnActivateRow event will be called for a table).
If you change the View property programmatically for a form element with an
extension (field, table, group or decoration), a new form element extension will be
created. Form element properties related to the extension are set to default values
and not propagated from the element extension modified before the View property
was changed.
NOTE
Note that form element properties related to data being displayed (e.g., DataPath,
TitleDataPath, etc.) can be modified only for new form elements and after the
form control view has been changed.
Chapter 7. Forms 1-429
Thus, to create a value table comprising two columns, you can use the following
program code:
MyAttributes = New Array;
MyAttributes.Add(New FormAttribute("DataTable",
New TypeDescription("ValueTable"),
,
"Value table",
False));
MyAttributes.Add(New FormAttribute("Vendor",
New TypeDescription("CatalogRef.Contractors"),
"DataTable",
"Vendor organization",
False));
MyAttributes.Add(New FormAttribute("Product",
New TypeDescription("CatalogRef.Goods"),
"DataTable",
"Product name",
False));
Please note that for the last two attributes the last but one parameter specifies the
attribute for which columns are created. In other words, you can add columns for
the attribute types that allow it.
Fig. 177 shows attributes created in the form editor using the code above.
After you have created all the required attributes in the form, you have to modify
the attribute list:
ChangeAttributes(AddedAttributes, DeletedAttributes);
When this code is executed, the system first deletes the attributes listed in the
DeletedAttributes array and then adds the attributes from the AddedAttrib-
utes array. After this the form is rebuilt.
When attributes are deleted, data they contain are lost; however, if the added and
deleted attributes have compatible types or the added attribute differs from the
deleted attribute by properties only (not the type), the data stored in the attribute
are preserved.
After the attribute is added, it can only be included in the program code using the
ThisObject.AttributeName construct. The ThisObject. expression is manda-
tory for attributes added programmatically.
Chapter 7. Forms 1-431
If you want to change the contents or properties of the attributes, you should first
obtain the attributes to be modified. To do this, you can use the GetAttributes()
method.
Please note that the obtained list has two special characteristics:
This list is not dynamic; it does not track the attribute changes that take place
after the method is called;
Although you can modify the obtained list, the changes you make have no effect
on the real properties of the form attributes.
After you obtain the form attribute list you want, you can perform actions with the
attributes (e.g., modify their titles) and then run the attribute modification method.
Attribute changes should be preceded by their deletion.
For example, if you want to change the properties of the OrderParameter
attribute, you should use the following code:
AttributeArray = GetAttributes("OrderParameter");
...
// Modify the attribute
...
ChangeAttributes(AttributeArray, DeletedAttributes);
Command = Commands.Add("StatusSettingCommand");
Command.Action = "ProgramCommandHandler";
Command.Title = "Set status";
EndProcedure
&AtClient
Procedure ProgramCommandHandler(Command)
EndProcedure
1-432 1C:Enterprise 8.3. Developer Guide
The command handler must exist in the form module and must be preceded by the
&AtClient compiler directive.
NOTE
A single handler can be used for multiple commands added programmatically.
&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
MyAttributes.Add(New FormAttribute("ObjectDescription",
TypeString,
"",
"Object Description", False));
ChangeAttributes(MyAttributes);
Command = Commands.Add("ChangeRow");
Command.Action = "ProgramCommandHandler";
Command.Title = "Change row";
EndProcedure
...
&AtClient
Procedure ProgramCommandHandler(Command)
EndProcedure
The form where this code is added will look as shown on fig. 178. This is the
form view after the user clicks the Change row button.
Then, to set this query parameter you should (in the OnCreateAtServer()
handler) specify the Warehouse and PriceType parameters as follows:
// ItemsList – form attribute of DynamicList type
// Parameters.Warehouse and Parameters.PriceType – form parameters of corresponding types
&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
ItemsList.Parameters.SetParameterValue("Warehouse", Parameters.Warehouse);
ItemsList.Parameters.SetParameterValue("PriceType", Parameters.PriceType);
EndProcedure
7.8.5.2. Filter
This section provides examples that show you how to set and delete filters in a
dynamic list.
Setting
The function adds a filter to a dynamic list and returns the filter item created.
Function AddFilter(FiltersList, FieldName, Value, ComparisonType = Undefined, Use = True)
NewItem = FiltersList.Items.Add(Type("DataCompositionFilterItem"));
NewItem.LeftValue = New DataCompositionField(FieldName);
NewItem.ComparisonType = ?(ComparisonType = Undefined,
Chapter 7. Forms 1-435
DataCompositionComparisonType.Equal, ComparisonType);
NewItem.RightValue = Value;
NewItem.Use = Use;
Return NewItem;
EndFunction
Usage example:
// DynamicList – form attribute of "DynamicList" type
// The "Contractor" column should be in the list
Deleting
This procedure deletes a dynamic list filter and returns the deletion result. If a field
name with the filter being removed is not specified, the filter list is cleared.
Function DeleteFilter(FiltersList, FieldName = "")
If IsEmptyString(FieldName) Then
FiltersList.Items.Clear();
Return True;
EndIf;
FilterDeleted = False;
For Each FilterItem In FiltersList.Items Do
FiltersList.Items.Delete(FilterItem);
FilterDeleted = True;
EndIf;
EndDo;
Return FilterDeleted;
EndFunction
1-436 1C:Enterprise 8.3. Developer Guide
Usage example:
// DynamicList – form attribute of "DynamicList" type
// The "Contractor" column should be in the list
7.8.5.3. Group
This section provides examples that show how to set and delete groups in a
dynamic list.
Setting
This function adds a group to a dynamic list and returns the group item created.
Function AddGroup(GroupList, FieldName, Use = True, GroupType = Undefined)
Field = New DataCompositionField(FieldName);
NewItem = GroupList.Items.Add(Type("DataCompositionGroupField"));
NewItem.Use = Use;
NewItem.Field = Field;
NewItem.GroupType = ?(GroupType = Undefined, DataCompositionGroupType.Items, GroupType);
Return NewItem;
EndFunction
Usage example:
// DynamicList – form attribute of "DynamicList" type
// The "Contractor" column should be in the list
//
// The group by field "Contractor" is created, the created
// group will be used, group type – only items
AddGroup(DynamicList.SettingsComposer.FixedSettings.Group, "Contractor");
Deleting
This procedure deletes a dynamic list group and returns the deletion result.
If a field name with the group being removed is not specified, the group list
is cleared.
Function DeleteGroup(GroupList, FieldName = "")
If IsBlankString(FieldName) Then
GroupList.Items.Clear();
Return True;
Chapter 7. Forms 1-437
EndIf;
GroupDeleted = False;
ItemsToDeleteArray = New Array;
For Each GroupItem In GroupList.Items Do
ItemsToDeleteArray.Add(GroupItem);
EndIf;
EndDo;
For Each ItemToDelete In ItemsToDeleteArray Do
GroupList.Items.Delete(ItemToDelete);
GroupDeleted = True;
EndDo;
Return GroupDeleted;
EndFunction
Usage example:
// DynamicList – form attribute of "DynamicList" type
//
// Deletes all groups in the dynamic list
Result = DeleteGroup(DynamicList.SettingsComposer.FixedSettings.Group);
Setting
This function adds a sorting field to a dynamic list and returns the order item
created.
Function AddOrder(OrdersList, FieldName, Use = True, OrderType = Undefined)
Field = New DataCompositionField(Field);
NewItem = OrdersList.Items.Add(Type("DataCompositionOrderItem"));
NewItem.Use = Use;
NewItem.Field = Field;
1-438 1C:Enterprise 8.3. Developer Guide
Usage example:
// DynamicList – form attribute of "DynamicList" type
// The "Description" column should be in the list
//
// Sets sorting on field "Description",
// sorting direction – descending , sorting is used
AddOrder(DynamicList.SettingsComposer.FixedSettings.Order, "Description", DataCompositionSortDirection.Desc);
Deleting
This procedure deletes a dynamic list sorting and returns the deletion result.
If a sorting field name is not specified, the order list is cleared.
&AtClient
Function DeleteOrder(OrdersList, FieldName = "")
If IsBlankString(FieldName) Then
OrdersList.Items.Clear();
Return True;
EndIf;
OrderDeleted = False;
ItemsToDeleteArray = New Array;
For Each OrderingItem In OrdersList.Items Do
ItemsToDeleteArray.Add(OrderingItem);
EndIf;
EndDo;
For Each ItemToDelete In ItemsToDeleteArray Do
OrdersList.Items.Delete(ItemToDelete);
OrderDeleted = True;
EndDo;
Return OrderDeleted;
EndFunction
Chapter 7. Forms 1-439
Usage example:
// DynamicList – form attribute of "DynamicList" type
//
// Performs deletion (not disabling)of order by "Description" field
Result = DeleteOrder(DynamicList.SettingsComposer.FixedSettings.Order, "Description");
// Set appearance condition: Amount > 500 AND Amount < 10000
List.AddFilter(FiltersGroup, "Amount", 500, DataCompositionComparisonType.Greater);
List.AddFilter(FiltersGroup, "Amount", 10000, DataCompositionComparisonType.Less);
Chapter 8
A special Query object is used by the system to generate and execute database
table queries. Query objects are convenient to use when you need to get a complex
data selection grouped and sorted as needed. The summary of the accounting
register condition for a specific point in time is a classical example of query
use. You can also use the query mechanism to get information for different points
in time.
one table corresponds to the objects of Catalog.Goods type, while another table
corresponds to the objects of Catalog.Contractors type. Each individual record
of an object table stores the status of an individual object of a corresponding type.
Accordingly, each object table has a Ref field which is a reference to the current
record. Moreover, object tables have a way of obtaining the user representation of
an object from the record field contents.
Object tables can also be hierarchical. Hierarchical tables have a special Parent
field that contains a reference to the record which, according to the hierarchy, is a
parent of the current record.
The following can be used as table fields:
A virtual or real table field
A nested table.
The main difference between a standard field and a nested table is that a standard
field corresponds to a single value within a record, while a nested table corre-
sponds to a QueryResult type value with a predefined set of columns. An
example of a nested table is a document or catalog tabular section.
The NULL type value can be used as a table field value type. Such values are
included in table record fields, for which the given field is undefined or mean-
ingless. For example, values of this type are included in the records (belonging to
catalog folders) for the fields that are defined only for the items of this catalog.
The rules that describe the query language include language constructs enclosed
in angle brackets. Keywords and function names are capitalized.
Language constructs can contain optional items, e.g. keywords. The rules that
describe the query language include optional items enclosed in brackets:
[THIS_IS_OPTIONAL_WORD]
[<This_is_optional_construct>]
In some cases, alternative elements can be used in a language construct. These
elements are separated by a vertical bar:
THIS_WORD | OR_THIS_WORD
<This_construct> | <Or_this_construct>
Descriptions of all constructs include examples explaining their order of use in the
query language.
For system enumerations, the value presentation looks like the following:
<SystemEnumName>.<Value>
Valid names of system enumerations are listed above. The list of allowable values
is given in each description.
For predefined configuration data, the value presentation looks like the following:
<PredefinedValueType>.<MetadataObjectName>.<Value>
Some fragments of queries explaining the use of predefined data in queries are
given below:
WHERE City = VALUE(Catalog.Cities.Moscow)
NOTE
Keyword names are not case sensitive.
1-446 1C:Enterprise 8.3. Developer Guide
As you can see from this rule, the query text consists of several parts or sections:
<Query description> – this is the only required section in the query text and
in many cases this is all you need. The section describes query data sources,
selection fields, groups, etc. In its turn, it is described by a whole set of rules
as explained below.
<Query union> – the query language allows you to consolidate the results of
several queries. For a description of the query union see page 1-463.
The <Results ordering> section helps define the string ordering conditions
in the query result. For a description of query result ordering see page 1-464.
AUTOORDER allows you to include automatic ordering string mode in the query
result. For a description of this mode see page 1-467.
The <Totals description> section lets you specify what totals must be calculated
in the query. For a description of this section see page 1-468.
Select
Document.Invoice.Ref
1-448 1C:Enterprise 8.3. Developer Guide
Result:
Select
Document.Invoice.Contractor
Result:
As you can see, there are many duplicate lines in the query result, reducing its
clarity. To prevent repetition, you can use the DISTINCT keyword in the query
description.
Example:
Select Distinct
Document.Invoice.Contractor
Result:
Select Top 5
Catalog.Nomenclature.Description,
Catalog.Nomenclature.PurchasePurchasePrice
Order by
Catalog.Nomenclature.PurchasePurchasePrice Desc
Result:
<Selection field>
<<Field description>> [[AS] <Field alias>]
<Field description>
<Expression>[.<Fields group>]|<Empty table description>
<Aliases List>
[<Field alias>][,<Aliases list>]
The selection field list consists of one or more comma-separated items. Each selec-
tion field consists of the selection field description and an optional field alias.
Instead of fields listing, you can use an asterisk (*) in the selection list. It means
that the query result should contain all fields that exist in the query's source tables
(data sources) included in the list of sources.
NOTE 1
When using an asterisk (*) in the selection fields list, the result will not include
virtual fields of the source tables.
NOTE 2
Retrieval of large selections (more than 64 MB) requires sufficient free space on
the hard drive used to store the server and client's temporary files.
Field description describes how field values must be generated. In the simplest
case, a selection field is a reference to a field in the source table. The reference
can include specification of the table containing this field or it can be defined
without specifying the table. For information about dereferencing fields see page
1-474.
In general, a selection field can represent an expression, rather than just a source
table field reference (for details see page 1-470).
Chapter 8. Work with Queries 1-451
Query results can be grouped (see page 1-461) using aggregate functions (see page
1-474) specified in the selection fields as expressions.
You can assign an alias to any selection field (see page 1-451). You can use the
field alias for easy access to the field.
You can use fields group only when the selection field references a nested table
(see page 1-452). In this case you can define which fields must be processed in the
selection from the nested table. If the fields group is omitted, all fields of the
nested table are processed.
Select
Catalog.Nomenclature.Name AS Product,
Catalog.Nomenclature.Parent.Name As Group
From
Catalog.Nomenclature
Result:
Please note that fields in the query result are named Product and Group. If you
did not specify field aliases, the fields in the query result would be named Name
and Name1 (field names in the query result cannot be same, therefore 1 is auto-
matically added to the second field name) which is much less convenient.
<Nested field>
<Expression> [[AS] <Field alias>]
A list of nested fields consists of one or more comma-separated items. If the list
consists of one item, then it does not need to be enclosed in parentheses.
Instead of nested fields listing, you can use an asterisk ("*"); this means that the
nested query result must contain all fields of the nested table.
A nested field can represent an expression (see page 1-473). In the simplest case an
expression is a reference to the nested table field.
Each nested field can have an alias. Like the field aliases of the selection list, these
field aliases can be used to access the fields more conveniently (see page 1-451).
You can assign aliases to nested fields regardless of whether or not the alias of the
nested table itself is given.
Example:
// Consignment note specifications (the document, assortment and //quantity) must be added to the report.
Select
Document.Invoice.Ref,
Document.Invoice.Contents.(Nomenclature As Product, Count)
Chapter 8. Work with Queries 1-453
Result:
Please note that the Content field in the query result appears as a nested table
with Nomenclature and Count fields.
The FROM keyword is followed by the source list. Generally, the source list
is described by the following set of rules:
<Source list>
<Source>[, <Source>[, …]]
<Source>
<Source description> [ <Joining list> ]
<Source description>
<Table> [[AS] <Source alias>]
<Table>
<Table name>[(<Parameters>)] | ( <Query description> )
Query data sources are listed in the list of sources (comma-separated). Each source
in the list must include a description; additionally you can indicate a joining list –
rules for joining a source with other sources. For a description of join specification
see page 1-454.
If you use an infobase table as a data source, the source description contains
a table name.
If the source table is virtual, then you can indicate its formation parameters.
For a detailed description of virtual table parameters, see Script – Working with
Queries – Query tables in the built-in help.
You can also use a nested query as a query data source. In this case the source
description contains a description of the query. For a description of nested queries
see page 1-460.
The data source description can also contain a source alias. The alias can be used
to access this source more conveniently.
Result:
The query result contains combinations of all contractors with all price types.
This result does not have meaning on its own. Usually, combinations of records
from different source tables must be limited by certain conditions. In the query
language you can describe a joining of sources, by indicating the sources them-
selves and defining conditions by which record combinations are included in the
query result.
There are different ways of joining; these are described by the following rules:
<Joining list>
<Join> [<Joining list>]
<Join>
[INNER] JOIN <Source description> BY <Filter criterion> |
LEFT [OUTER] JOIN <Source description> BY <Filter criterion> |
RIGHT [OUTER] JOIN <Source description> BY <Filter criterion> |
FULL [OUTER] JOIN <Source description> BY <Filter criterion>
Generally, a joining list can contain and describe a single join (two sources) or
multiple joins of multiple sources.
Source description contains a description of the source table (see page 1-453).
Filter criterion contains conditions used to join data from the query source tables
in the selection. For information about rules of condition description in the query
language see page 1-488.
The LEFT, RIGHT and FULL keywords specify the nature of the join. INNER and
OUTER are optional; they improve the clarity and readability of the query text.
Joined sources are not equal and in some cases the result depends on which table
is indicated first, before the JOIN keyword (to the left) and which is second (to the
right of the keyword).
1-456 1C:Enterprise 8.3. Developer Guide
Two simple tables can be used to describe the joins. One of the tables is named
Companies, consists of two fields (Name and Telephone Number) and contains
the following data:
The other table is named Contacts, consists of three fields (Name, Telephone
Number and Company), the latter being a reference to a Companies table item.
The table contains the following data:
NOTE
In 1C:Enterprise terms, both tables are catalogs.
Inner Join
An inner join means that only record combinations meeting the specified condi-
tion from both initial data source tables must be included in the query result.
The remaining records are not included in the result.
Example:
SELECT
Companies.Name AS Company,
Contacts.Name AS Contact
FROM
Catalog.Contacts AS Contacts
INNER JOIN Catalog.Companies AS Companies
BY Contacts.Company = Companies.Ref
Result:
Result:
Example:
SELECT
Contacts.Name AS Contact,
Companies.Name AS Company
FROM
Catalog.Contacts AS Contacts
RIGHT JOIN Catalog.Companies AS Companies
BY Contacts.TelephoneNumber = Companies.TelephoneNumber
Result:
Result:
This example demonstrates the use of the Product alias assigned to the Catalog.
Nomenclature source table in the selection fields list.
SELECT TOP 8
InvoiceContent.Ref,
InvoiceContent.Nomenclature,
InvoiceContent.Count
FROM
Document.Invoice.Content AS InvoiceContent
Result:
Please note that when you indicate a nested table in the source list, you can
access both fields from the nested table and fields from the top-level table
(containing the nested table) through the Ref field. In this case you access the
Ref.FieldDescription field of the document itself.
SELECT
Contractors.Description
FROM
Catalog.Contractors AS Contractors
WHERE Contractors.Type = VALUE(Enum.ContractorTypes.Person)
Chapter 8. Work with Queries 1-461
Result:
NOTE
The field in the clause WHERE does not have to be entered into the selection list.
You can define a filter criterion as a simple logical expression or a more complex
expression, where simple logical expressions are connected to each other by the
logical operators AND or, NOT. For a description of criteria in the query language
see page 1-488.
Example:
// You want to obtain statistics on the product sales:
// maximum, minimum and average prices in invoices.
Select
Invoice.Nomenclature,
Avg (Invoice.Price) As Avg,
Max (Invoice.Price) As Max,
Min (Invoice.Price) As Min,
From
Document.Invoice.Content AS Invoice
Group By
Invoice.Nomenclature
Result:
SELECT
Invoice.Nomenclature,
SUM(Invoice.Count) AS Count
FROM
Document.Invoice.Content AS Invoice
GROUP BY
Invoice.Nomenclature
HAVING
SUM(Invoice.Count) > 20
Chapter 8. Work with Queries 1-463
Result:
IMPORTANT!
You can only use aggregate functions and fields used for grouping in filter criteria.
Query union begins with the required UNION keyword, followed by a description
of the query to be merged with. Then you can join another query, etc.
By default, identical strings in the query result generated by different queries are
replaced by one string. If you need to leave duplicate strings, use the ALL keyword.
Example:
SELECT
Receipt.Nomenclature AS Product,
SUM(Receipt.Count) AS Receipt,
SUM(0) AS GoodsConsumption
FROM
Document.ReceiptOfGoods.Content AS Receipt
1-464 1C:Enterprise 8.3. Developer Guide
GROUP BY
Receipt.Nomenclature
UNION
SELECT
GoodsConsumption.Nomenclature,
SUM(0),
SUM(GoodsConsumption.Count)
FROM
Document.Invoice.Content AS GoodsConsumption
GROUP BY
GoodsConsumption.Nomenclature
Result:
<Order conditions>
<Order field> [<Order>]
[, <Order field> [<Order>][, …]]
<Order field>
<Expression> <Order> ASC | DESC | HIERARCHY | HIERARCHY DESC
In the ORDER BY clause, conditions for ordering query results are separated by
comma. Selections are first ordered by the first condition, then by the second, etc.
The order condition generally can appear as an expression (see page 1-470). Lines
of the query result will be ordered by the expression values calculated for each line.
You can order values in ascending or descending order or, if the hierarchical
structure property is set for a table, you can use ordering by hierarchy (see page
Chapter 8. Work with Queries 1-465
1-465). You can indicate order for each field independently. For a description of
value comparison rules see page 1-490.
Ordering condition fields do not have to be included in the query result.
Example:
// Select five most expensive goods,
// ordering them in descending order by their price.
SELECT TOP 5
Nomenclature.Description,
Nomenclature.PurchasePurchasePrice
FROM
Catalog.Nomenclature AS Nomenclature
ORDER BY
Nomenclature.PurchasePurchasePrice DESC
Result:
Result:
You can only sort hierarchically by field, but not by operation: the order field must
contain a reference to the source table field (query data source).
IMPORTANT!
It makes sense to order by hierarchy only if the catalog table is defined as the
source, rather than some other table containing a reference to the catalog only.
Example:
SELECT
Invoice.Contractor.Description,
Invoice.Number,
Invoice.Warehouse,
FROM
Document.Invoice AS Invoice
In this example, hierarchical ordering is not possible, since there is no a link to
the catalog and folders from this catalog are not included in the query result.
To apply ordering by hierarchy, you must link to the catalog.
Example:
SELECT
Contractors.Description AS Description,
Invoice.Number,
Invoice.Warehouse
FROM
Catalog.Contractors AS Contractors
LEFT JOIN Document.Invoice AS Invoice
BY Contractors.Ref = Invoice.Contractor
ORDER BY
Description HIERARCHY
Result:
Select
Document.Invoice.Ref,
Dcument.Invoice.Content.(Nomenclature As Product, Count)
Order By
Document.Invoice.Number,
Document.Invoice.Content.Nomenclature.Description
<Totals>
TOTALS [<List_of_totals_fields>] BY [OVERALL] <List of check points>
<List of totals_fields>
<Totals_field> [,<List_of_totals_fields> [, …]]
<Totals_field>
<Aggregate_function> | <Expression> [[AS] <Field_alias>]
<Check point>
<Expression> [[ONLY] HIERARCHY] | [PERIODS(Second | Minute | Hour | Day | Week | Month |
Quarter | Year | TenDays| HalfYear
[,<DATE type literal> | <Parameter ID>]
[,<DATE type literal> | <Parameter ID>])] [[AS] Field alias]
Result:
If necessary, you can calculate value totals by hierarchy only, without calculating
totals in the check points. To do so, use the ONLY keyword before the HIERARCHY
keyword.
Example:
SELECT
Document.Nomenclature AS Nomenclature,
Document.Count AS Count,
Document.Ref.Number,
1-470 1C:Enterprise 8.3. Developer Guide
Document.Ref.Contractor
FROM
Document.Invoice.Content AS Document
ORDER BY
Document.Nomenclature
TOTALS
SUM(Count)
BY
Nomenclature ONLY HIERARCHY
Result:
Result:
This kind of presentation is possible only if all period records are used as the
dimension source in the course of result tabbing by the Period group.
Result:
Result:
ORDER BY
Document.Nomenclature
TOTALS
SUM(Count)
BY
Nomenclature ONLY HIERARCHY AS Goods
If an alias is not specified, the system will provide a unique name for the total.
In the above example, the total will have the Goods name.
<Binary operation>
+ | – | * | /
<Unary operation>
–|+
In the simplest case, an expression is a reference to a field of the query data source
table. The reference can include specification of the table containing this field or
it can be defined without specifying the table. For information about dereferencing
fields see page 1-474.
Expressions in the selection field list and in HAVING, TOTALS or ORDER BY clauses
can be represented by aggregate functions (see page 1-474).
An expression can be a built-in function of the query language (see page 1-477).
You can also use case operations (see page 1-485) and value type cast operations
(see page 1-486).
Expressions can include values of logical, numeric, string and other constants; query
parameter values can also be used (see page 1-487). Binary and unary operations can
be applied to values of appropriate types within expressions. Checking the divider
for zero value is recommended when the division operation is used.
1-474 1C:Enterprise 8.3. Developer Guide
<Table>
<Table name> | <Source alias>
Dereferencing of fields begins with the name of the table containing this field. If
the field name is unique (it exists in only one of the tables indicated in the source
list), the table can be omitted.
If the field has a reference type, the query language allows you to access fields
in the referenced table, etc. Field names are period-separated.
If a source alias is assigned to the source table in the source list, you can use
it instead of the table name in dereferencing fields of this table. Otherwise the
table name is specified (see query data source description).
Example:
SELECT
Invoice.Nomenclature.Description,
SUM(Invoice.Sum) AS Sum
AVG (Invoice.Sum) AS Avg,
MAX(Invoice.Sum) AS Max,
MIN(Invoice.Sum) AS Min,
COUNT(Invoice.Sum) AS Count
FROM
Document.Invoice.Content AS Invoice
Chapter 8. Work with Queries 1-475
GROUP BY
Invoice.Nomenclature,
Invoice.Nomenclature.Description
TOTALS BY
OVERALL
Result:
You can use aggregate functions in the selection fields list and in the HAVING,
TOTALS or ORDER BY clauses.
SUM
Description:
This function calculates the arithmetic sum of all entries in the field value
selection.
You can only indicate fields containing a numerical value as a function param-
eter.
If the field cannot contain a numerical value, then using the SUM function will
produce an error. You can apply this function to the field, only if the field can
contain numerical values (has a composite data type). But if there is a non-nu-
merical value among the field values (besides NULL), then an error will occur.
AVG
Description:
This function calculates the average value of all entries in the field value selec-
tion.
You can only use references to fields containing numerical values as a function
parameter.
If the field cannot contain a numerical value, then using the AVG function will
produce an error. You can apply this function to the field, only if the field can
contain numerical values (has a composite data type). But if there is a non-nu-
merical value among the field values (besides NULL), then an error will occur.
1-476 1C:Enterprise 8.3. Developer Guide
MIN
Description:
This function calculates the minimum value of all entries in the field value
selection.
You can use references to fields that contain values of every type as a function
parameter.
In defining the minimum value, value comparison rules are applied, as described
in the "Value Comparison Rules" section.
MAX
Description:
This function calculates the maximum value of all entries in the field value
selection.
You can use expressions that contain values of every type as a function
parameter. It can not be used either with expressions of ValueStorage or with
MomentInTime type, or with strings of unlimited length.
In defining the maximum value, value comparison rules are applied, as
described in the "Value Comparison Rules" section.
COUNT
Description:
This function calculates the count of parameter values in the selection. As
opposed to other aggregate functions, you can use COUNT in three ways:
This function allows you to calculate the count of values that are not equal
to NULL in a given field.
This function allows you to calculate the count of various values that are
not equal to NULL in a given field; To do so, you must use the DISTINCT
keyword before the field specification.
This function can calculate the count of rows in the query result. To do so,
use an asterisk ("*") as a function parameter.
You can use references to fields that contain values of every type as a function
parameter.
Example:
SELECT
COUNT(*) AS Total,
COUNT(DISTINCT Invoice.Nomenclature) AS Different
FROM
Document.Invoice.Content AS Invoice
Chapter 8. Work with Queries 1-477
Result:
SUBSTRING
Description:
This function is used to extract a substring from a string. This function has
three parameters.
A string that requires obtaining a substring. It's an expression of the String
type;
The position of the character where the substring is to begin. It's a value of
the Number type;
Length of the obtained substring. It is a value of Number type.
1-478 1C:Enterprise 8.3. Developer Guide
If the first parameter specifies a string, the result of the function is a string
(possibly of zero length). If the first parameter specifies a NULL value, the result
of the function is NULL. Other values are invalid and produce an error.
Example:
SELECT TOP 8
Contractors.Description,
SUBSTRING(Contractors.Description, 3, 5) AS Substring
FROM
Catalog.Contractors AS Contractors
Result:
YEAR
Description:
This function calculates the year number from a value of the Date type.
The function's parameter is an expression of the Date type.
If the parameter contains a value of the Date type, the result of the function
is a value of the Number type. If the parameter specifies a NULL value, the
result of the function is NULL. Other values are invalid and produce an error.
QUARTER
Description:
This function calculates the quarter number from a value of the Date type.
The number of the quarter is between 1 and 4.
The function's parameter is an expression of the Date type.
If the parameter contains a value of the Date type, the result of the function
is a value of the Number type. If the parameter specifies a NULL value, the
result of the function is NULL. Other values are invalid and produce an error.
MONTH
Description:
This function calculates the month number from a value of the Date type.
The number of the month is between 1 and 12.
Chapter 8. Work with Queries 1-479
DAYOFYEAR
Description:
This function calculates the day number within a year from a value of the Date
type. The number of the day is between 1 and 366.
The function's parameter is an expression of the Date type.
If the parameter contains a value of the Date type, the result of the function
is a value of the Number type. If the parameter specifies a NULL value, the
result of the function is NULL. Other values are invalid and produce an error.
DAY
Description:
This function calculates the day number within a month from a value of the
Date type. The number of the day is between 1 and 31.
The function's parameter is an expression of the Date type.
If the parameter contains a value of the Date type, the result of the function
is a value of the Number type. If the parameter specifies a NULL value, the
result of the function is NULL. Other values are invalid and produce an error.
WEEK
Description:
This function calculates the week number within a year from a value of the
Date type.
The function's parameter is an expression of the Date type.
If the parameter contains a value of the Date type, the result of the function
is a value of the Number type. If the parameter specifies a NULL value, the
result of the function is NULL. Other values are invalid and produce an error.
WEEKDAY
Description:
This function calculates the day number within a week from a value of the
Date type. The number of the day is between 1 (Monday) and 7 (Sunday).
The function's parameter is an expression of the Date type.
1-480 1C:Enterprise 8.3. Developer Guide
If the parameter contains a value of the Date type, the result of the function
is a value of the Number type. If the parameter specifies a NULL value, the
result of the function is NULL. Other values are invalid and produce an error.
HOUR
Description:
This function calculates the hour of a day from a value of the Date type.
An hour value is between 0 and 23.
The function's parameter is an expression of the Date type.
If the parameter contains a value of the Date type, the result of the function
is a value of the Number type. If the parameter specifies a NULL value, the
result of the function is NULL. Other values are invalid and produce an error.
MINUTE
Description:
This function calculates the minute of an hour from a value of the Date type.
A minute value is between 0 and 59.
The function's parameter is an expression of the Date type.
If the parameter contains a value of the Date type, the result of the function
is a value of the Number type. If the parameter specifies a NULL value, the
result of the function is NULL. Other values are invalid and produce an error.
SECOND
Description:
This function calculates the second of a minute from a value of the Date type.
A second value is between 0 and 59.
The function's parameter is an expression of the Date type.
If the parameter contains a value of the Date type, the result of the function
is a value of the Number type. If the parameter specifies a NULL value, the
result of the function is NULL. Other values are invalid and produce an error.
BEGINOFPERIOD
Description:
This function is used to extract a certain date from a given date.
The function's parameter is an expression of the Date type and the period type
is one of the following: Minute, Hour, Day, Week, Month, Quarter, Year,
TenDays, HalfYear.
Chapter 8. Work with Queries 1-481
Example:
SELECT BEGINOFPERIOD(DATETIME(2002, 10, 12, 10, 15, 34), MONTH)
Result:
Example:
SELECT BEGINOFPERIOD(DATETIME(2002, 10, 12, 10, 15, 34), DAY)
Result:
ENDOFPERIOD
Description:
This function is used to extract a certain date from a given date.
The function's parameter is an expression of the Date type and the period type
is one of the following: Minute, Hour, Day, Week, Month, Quarter, Year,
TenDays, HalfYear.
Example:
SELECT ENDOFPERIOD(DATETIME(2002, 10, 12, 10, 15, 34), MONTH)
Result:
Example:
SELECT ENDOFPERIOD(DATETIME(2002, 10, 12, 10, 15, 34), YEAR)
1-482 1C:Enterprise 8.3. Developer Guide
Result:
DATEADD
Description:
This function is used to add values to a date.
The first parameter is a source date which is to be supplemented by the value
defined by the second and third parameters; it is an expression of the Date
type.
The second parameter, the increment type, is one of the following: Second,
Minute, Hour, Day, Week, Month, Quarter, Year, TenDays, HalfYear.
The third parameter is the value which is to be added to the date specified by
the first parameter. It is a value of the Number type (fractional part is ignored).
Example:
SELECT DATEADD(DATETIME(2002, 10, 12, 10, 15, 34), MONTH, 1)
Result:
Example:
SELECT DateAdd(DateTime(2002, 10, 12, 10, 15, 34), Day, 5)
Result:
DATEDIFF
Description:
This function is used to obtain differences between two dates.
Chapter 8. Work with Queries 1-483
The first parameter is an expression of the Date type. The second parameter
is an expression of the Date type. The third parameter, the difference type,
is one of the following: Second, Minute, Hour, Day, Month, Quarter, Year.
Example:
SELECT DATEDIFF(DATETIME(2002, 10, 12, 10, 15, 34), DATETIME(2002, 10, 14, 9, 18, 06), DAY)
Result:
Example:
SELECT DATEDIFF(DateTime(2002, 10, 12), DateTime(2002, 11, 03), MONTH)
Result:
IMPORTANT!
This function calculates the calendar difference between two dates; therefore, you
cannot use it in places where you must calculate the count of bank or work days
between two dates.
VALUETYPE
Description:
The function that obtains the value type in a query.
Parameters:
The function's parameter is an expression of any type.
The return value is a Type value.
Example:
SELECT
VALUETYPE(NomenclatureAccounting.Recorder) AS Document
FROM
AccumulationRegister.NomenclatureAccounting AS NomenclatureAccounting
1-484 1C:Enterprise 8.3. Developer Guide
PRESENTATION
Description:
This function returns the string presentation of a value of arbitrary type.
The function's parameter is an expression of any type.
The return value is a String value.
The result of the function cannot be used within other functions, except for the
PRESENTATION function.
Example:
SELECT
PRESENTATION(Document.Contractor) AS Recipient,
PRESENTATION(Document.Date) AS Date
FROM
Document.Invoice AS Document
Result:
ISNULL
Description:
This function replaces a NULL value with another value.
Function parameters:
The first parameter is an expression of any type;
The second parameter is an expression of any type.
The return value is that of the first parameter if it is not NULL; otherwise
it is the value of the second parameter.
The second parameter is cast to the type of the first parameter if the type of the
first parameter is String or Number.
Example:
// Obtain sum based on Count field. If no record
// exists, display 0
SELECT
ISNULL(SUM(InvoiceContent.Count), 0)
FROM
Document.Invoice.Content AS InvoiceContent
Chapter 8. Work with Queries 1-485
<Case alternatives>
<Single case>
[<Case alternatives>]
<Single case>
WHEN <Logical expression>
THEN <Expression>
Result:
<Type cast>
CAST ( <Expression> AS <Value type> )
<Value type>
Boolean |
Number [(Length[, Precision])]|
String [(Length)]|
Date |
<Table name>
<Length>
Number
<Precision>
Number
The expression is cast to one of the primitive types or a data reference type. In the
latter case the table name refers to the corresponding infobase table.
If the expression contains the required value type in its composite type, then type
casting is possible and the result for each value of the specified type will be the
value itself. For values of other types, the result of type cast will be NULL.
If the expression does not contain the required value type in its composite type,
the query execution will be completed with an error because type casting cannot be
performed.
Chapter 8. Work with Queries 1-487
Values of Boolean, Number and String types are specified in the same way as
in the 1C:Enterprise script.
Date type values are specified using the DATETIME keyword followed by the
sequence of year, month, day, hour, minute and second. The last three components
are optional.
IMPORTANT!
The maximum date you can specify using the DATETIME literal is 12/31/3999
23:59:59.
You can pass multiple parameters to a query (see a description of the Query
object). Parameter values can be used in the query language expressions. In this
case you need to specify the "&" character followed by the parameter name.
<Type type literal>
TYPE(<Type name>)
Example:
// Retrieval of the String type
TYPE(String)
Type values can be used in comparison ordering and grouping operations of the
query language.
Example:
SELECT
VALUETYPE(Balance.Recorder)
FROM
AccumulationRegister.NomenclatureAccounting AS Balance
WHERE
VALUETYPE(Balance.Recorder) = TYPE(Document.Invoice)
When Type values are compared, they have the following order (the type listed first
is the smallest):
NULL
Undefined
Boolean
Number
Date
String
References to a table
Other types
<Logical component>
<Logical factor> [AND <Logical factor>]
<Logical factor>
NOT <Logical factor> |
( <Filter criterion> ) |
<Logical expression>
In the simplest case, a condition is an expression with a result having a logical
type value. Logical expression are described in the next section.
Conditions can also be defined as more complex expressions, where simple logical
expressions are joined using the logical operators AND or, NOT.
Logical operators have the following priorities:
NOT has the highest priority.
AND is next in priority.
OR has the lowest priority.
Simple logical expressions are calculated first, then NOT, then AND and finally
OR. In order to set another calculation order, you can use parentheses ().
<Comparison operation>
> | < | = | >= | <= | <>
<Value list>
<Expression>[, <Expression> [, …]]
spaces, unlike string comparison in 1C:Enterprise script where ending spaces
are used in comparison operations. For example, comparing the strings "bb"
and "bb " in 1C:Enterprise script returns False (strings are not equal), but
it returns True in the query language (strings are equal).
Reference types are compared based on their values (entry number, etc.).
Fields of the UniqueIdentifier type cannot be compared to other fields.
You cannot compare open-ended fields (open-ended strings, ValueStorage,
ValueType field from charts of characteristic types tables).
IMPORTANT!
Any comparison operation with at least one NULL value results in False.
SELECT
Nomenclature.Description
FROM
Catalog.Nomenclature AS Nomenclature
WHERE
Nomenclature.Ref IN HIERARCHY(&Group)
1-492 1C:Enterprise 8.3. Developer Guide
The query result can act as a value array that is checked for matching. In this case
you need to specify a query description to the right of IN operator.
Example:
SELECT
Nomenclature.Description
FROM
Catalog.Nomenclature AS Nomenclature
WHERE
Nomenclature.Ref IN HIERARCHY
(SELECT
Nomenclature.Ref
FROM
Catalog.Nomenclature AS Nomenclature
WHERE
Nomenclature.Description = "Clothes")
IN operator form to check for matching with one of the query results
Below is an example of how you can use this operator:
Example:
// Select product names included
// in the invoices
SELECT
Goods.Description
FROM
Catalog.Nomenclature AS Goods
WHERE
Goods.Ref IN
(SELECT
InvoiceContent.Nomenclature
FROM
Document.Invoice.Content AS InvoiceContent)
Result:
To obtain an inverse result (i.e. if you need to determine that the value does not
match any of the query results) you should use the following query:
Example:
// Select product names included
// in the invoices
SELECT
Goods.Description
FROM
Catalog.Nomenclature AS Goods
WHERE
(NOT Goods.Ref IN
(SELECT
InvoiceContent.Nomenclature
FROM
Document.Invoice.Content AS InvoiceContent))
Result:
Please note that you can call table fields that encountered in the external query
before the operation from IN operation query.
Example:
// Select product names included
// in the invoices
SELECT
Goods.Description
FROM
Catalog.Nomenclature AS Goods
WHERE
Goods.Ref IN
(SELECT
InvoiceContent.Nomenclature
FROM
Document.Invoice.Content AS InvoiceContent
WHERE
InvoiceContent.Nomenclature = Goods.Ref)
1-494 1C:Enterprise 8.3. Developer Guide
Result:
Example:
SELECT
Nomenclature.Description,
Nomenclature.PurchasePrice
FROM
Catalog.Nomenclature AS Nomenclature
WHERE
Nomenclature.PurchasePrice IS NULL
// Generate a query
Query = New Query("SELECT Product.Description Description,
|Product.Parent.Description ParentDescription
|FROM Catalog.Goods Product");
// Execute the query and write the result to the QueryResult variable.
QueryResult = Query.Execute();
As you can see from this example, work with queries is based on three main
objects:
Query – an object that executes the query. In the example, this object is repre-
sented by the Query variable.
QueryResult – an object that contains the query result. In the example, this
object is represented by the QueryResult variable.
QueryResultSelection – an object that can be used to select (i.e. tab through)
records in the result. In the example, this object is represented by the Selec-
tion variable.
Review the QueryResultSelection object in more detail.
Use the following query for this purpose:
SELECT
InvoiceContent.Nomenclature AS Nomenclature,
InvoiceContent.Count AS Count
FROM
Document.Invoice.Content AS InvoiceContent
ORDER BY
InvoiceContent.Nomenclature
TOTALS
SUM(Count)
BY
Nomenclature HIERARCHY
Result:
In this table we have added column No.1 which is not present in the query result.
We will use it later to identify query result records. Totals records in the table are
shown in italic, while the totals records for hierarchical catalog levels are shown
in bold.
1-498 1C:Enterprise 8.3. Developer Guide
In this example, selection from the results using hierarchical iteration will be
completed only for records 1 and 11, as these are the only two records that are
located at the highest level. To illustrate this, let us assume that the result is a tree,
where totals records are nodes and detailed records are leaves. Here is what we
will get (see fig. 222).
From this picture, you can see that only records 1 and 11 are located at the top
level of the tree and that only these records will be included in the first pass of
hierarchical iteration.
The next question would be how to obtain other records of the query result.
To do this, you can get another selection from the QueryResultSelection object.
This selection will be used for iteration over the subordinate records of the current
selection record. In this example, when the Selection2 object is to be placed
into record No 1, we will ask it for a hierarchical selection. This way, we will
get a selection that will return records 2 and 7. When Selection2 is to be placed
in record No 11, the final hierarchical selection will return records 12 and 16.
This is how the hierarchical iteration for query results works.
Chapter 8. Work with Queries 1-499
Please note that you can obtain nested selections of any type from the parent selec-
tion. Thus, if you request a linear Selection2, placed into record 1, it would
return records 2 to 10. Review an example of this technique.
Example:
Procedure ExecuteQuery()
// Generate a query.
Query = New Query;
OutputRecursively(Selection);
EndProcedure
Procedure OutputRecursively(Selection)
// While the selection contains records ...
While Selection.Next() Do
// ... display result fields in the message window
Product = Selection.Description;
Count = Selection.Count;
Message("Product: " + Product + " Count: " + Count);
Example:
Procedure ExecuteQuery()
// Generate a query.
Query = New Query;
|Document.Invoice.Content AS InvoiceContent
|ORDER BY
|InvoiceContent.Nomenclature
|TOTALS
|SUM(Count)
|BY
|Nomenclature HIERARCHY";
OutputChildRecords(Selection.Select());
EndDo;
EndProcedure
Procedure OutputChildRecords(Selection)
// While the selection contains records ...
While Selection.Next() Do
// ... display result fields in the message window
Product = Selection.Description;
Count = Selection.Count;
Message("Product: "+Product+" Count: "+Count);
EndDo;
EndProcedure
ORDER BY
Doc.Nomenclature.Description,
Contractor
Result:
You get a linear selection from the query result and can use the NextByField-
Value() method for iteration.
Example:
Selection = QueryResult.Select();
While Selection.NextByFieldValue("Product") Do
// there we'll get records with numbers 1, 5, 9, 12
While Selection.NextByFieldValue("Contractor") Do
// there we'll get records with numbers 1, 2, 3, 4 at first
// then we'll get records with numbers 5, 6, 7
// then we'll get records with numbers 9, 10, 11
// then we'll get records with numbers 12, 13, 14, 15
EndDo;
EndDo;
Please note that record 8 is not selected in the internal cycle, since it has the same
Recipient field value as the previous record.
Chapter 8. Work with Queries 1-503
If you use the Next() method to get records by field value, all records with the
same field value specified during the previous call of the NextByFieldValue()
method will be selected.
Example:
Selection = QueryResult.Select();
While Selection.NextByFieldValue("Product") Do
// there we'll get records with numbers 1, 5, 9, 12
While Selection.Next() Do
// there we'll get records with numbers 1, 2, 3, 4 at first
// then we'll get records with numbers 5, 6, 7, 8
// then we'll get records with numbers 9, 10, 11
// then we'll get records with numbers 12, 13, 14, 15
EndDo;
EndDo;
ORDER BY
InvoiceContent.Nomenclature
TOTALS
SUM(Count)
BY
Nomenclature HIERARCHY
1-504 1C:Enterprise 8.3. Developer Guide
Result:
Example:
TempTablesManager = New TempTablesManager;
All the temporary tables created in the given manager instance exist only while the
temporary tables manager instance exists. If the manager instance is destroyed, all
of its temporary tables are also deleted.
The temporary tables manager can be forced to close by using the Close() method.
This will delete all tables created in it. Further work with this manager will
become impossible.
A temporary table can be created based on database data or external source data
(for example, a value table).
In order to create a temporary table based on database data, set the temporary
tables manager for the Query object, then run a database query using the INTO
keyword followed by the name of the created temporary table. The INTO keyword
is located after the query selection list.
Example:
SELECT
Nomenclature.Code,
Nomenclature.Description
INTO TemporaryTable
FROM
Catalog.Nomenclature AS Nomenclature
The query result will contain a single row with a Count column that will include
the records placed in the created table.
If the temporary tables manager is not set or is closed or the specified temporary
tables manager already has a table with the specified name, an error message will
appear.
If you do not want to use an external source as a basis for temporary tables, you
can use the FOR UPDATE clause; this is required when you need to place data into
1-506 1C:Enterprise 8.3. Developer Guide
a temporary table and at the same time prevent other transactions from reading the
data by locking it.
Example:
SELECT
Invoice.Ref,
Invoice.Number,
Invoice.Date,
INTO TemporaryTable
FROM
Document.Invoice AS Invoice
WHERE
Invoice.Ref IN(&Documents)
FOR UPDATE
If you need to create an index for a temporary table, specify the INDEX BY
keyword in the query followed by the fields used to build an index.
Example:
SELECT
Nomenclature.Code AS Code,
Nomenclature.Description
INTO TemporaryTable
FROM
Catalog.Nomenclature AS Nomenclature
INDEX BY
Code
FOR UPDATE
Chapter 8. Work with Queries 1-507
In order to create temporary tables based on an external source, specify the name
of the parameter in which the external source will be placed, in the list of sources
in the query text. The remaining syntax is identical to the usual creation of
a temporary table.
The following entities can be external sources:
Value table
Tabular section
Query result
An example of the temporary table created on basis of external source is shown
below:
SELECT
Source.Code,
Source.Description
INTO TemporaryTable
FROM
&ExternalSource AS Source
In this example, the contents of the Code and Description columns are placed to
TemporaryTable from an external source, for example, a value table passed as the
ExternalSource parameter.
IMPORTANT!
You can't create a temporary table if it is created based on value tables with
a UUID-type value in the columns.
IMPORTANT!
If a temporary table is on basis of external source, do not use unions and joins
in the query or the fields that are field attributes of the tables used as a basis for
the temporary table.
If the table to be dropped does not exist, an error message will be displayed.
1-508 1C:Enterprise 8.3. Developer Guide
Result = Query.Execute();
The first query creates a temporary table; its data are used in the second query.
If the temporary tables manager is set for the Query object that executes the batch
query, temporary tables that were not terminated within the batch query will be
saved in this manager. Within the text of a batch query, you may use and destroy
temporary tables that existed in the assigned temporary tables manager at the batch
execution start.
In addition to the Execute() method that executes all batch queries sequentially
and returns the result of the last batch query, the 1C:Enterprise platform provides
another method, i.e. ExecuteBatch(). This method executes all queries sequen-
tially and returns a result array for each query in the batch according to the
succession of queries within the batch text. A query to terminate a temporary table
results in the Undefined value which will also be included in the result array.
Chapter 9
No form ID is specified. In this case the applied lock is not associated with
any form. It is automatically released when a session is terminated or control
return from the server or transaction is complete (if the lock was placed on the
transaction). You can also release the lock using the global context UnlockDa-
taForEdit() method without specifying the form ID.
Please note, however, that locking an object does not guarantee it cannot be
updated or removed from the database. Therefore, to ensure the locked object
cannot be modified, another session must attempt to lock it, too, before the modifi-
cation operation. An attempt to lock a previously locked database object raises an
exception that can be processed using Try … Except … EndTry.
&AtServer
Function SampleModification()
ProductRef = Catalogs.Goods.FindByCode("000000001");
Try
LockDataForEdit(ProductRef);
// Object data can be modified
// ...
ProductObject = ProductRef.GetObject();
ProductObject.Description = "New description";
ProductObject.Write();
Return True;
Except
Please remember that concurrent attempts to lock an object with form ID and
without it are incompatible.
ProductRef = Catalogs.Nomenclature.FindByCode(1);
LockDataForEdit(ProductRef);
Try
LockDataForEdit(ProductRef, , FormID);
Except
EndTry;
Chapter 9. Work with Data 1-511
The developer can release a pessimistic lock using the global context UnlockDa-
taForEdit() method.
9.2. TRANSACTIONS
Regardless of the selected 1C:Enterprise version (file mode version or client/server
mode), the system works with information stored in the database through transac-
tions.
A transaction is a sequence of data manipulation operations that is atomic
in terms of its impact on the database. Transactions are "all-or-nothing" in nature;
they transition the database from one status to another in its entirety. If one of the
transaction actions cannot be completed for some reason or the system has encoun-
tered an error, the database returns to its pre-transaction status (the transaction
is rolled back).
1-512 1C:Enterprise 8.3. Developer Guide
Therefore, a general layout of use of transactions can look like the following:
BeginTransaction();
// A sequence of operators
…
Try
Except
RollbackTransaction();
EndTry;
CommitTransaction();
As you apply this procedure, please remember that errors you encounter when you
work with the database can be processed by the system in different ways.
Generally, all database errors fall into one of two categories:
Non-recoverable errors
Recoverable errors
Non-recoverable errors can disturb normal operation of 1C:Enterprise system,
e.g. by corrupting data. A non-recoverable error always results in 1C:Enterprise
termination.
If a non-recoverable error occurs in the course of a transaction, all changes made
within this transaction are rolled back by the system.
Recoverable errors do not cause major breakdowns in 1C:Enterprise operation.
In case of a recoverable error the system can continue functioning. The opera-
tion that caused the error is aborted and an exception is raised; the latter can be
captured and processed using Try … Except … EndTry.
If a recoverable error occurs in the course of a transaction, the system does not
automatically abort the transaction, allowing the developer to resolve the issue.
The nature of the error defines the issue resolution scenario.
If the error is not related to the database, the transaction can be continued and the
module operation does not have to be terminated. If necessary, the developer can
cancel the transaction or, on the contrary, carry it on if the error does not interfere
with the transaction's atomic nature.
If, however, the exception is due to a database error, the system registers the error
state of the transaction and continuing or committing the transaction becomes
impossible. The only database operation available to the developer in this case
is a transaction rollback. The developer can re-try the transaction later.
1-514 1C:Enterprise 8.3. Developer Guide
A sample code that uses this approach to writing data to the database can look like
the following.
// Abort write attempts flag
Written = False;
Try
BeginTransaction();
Data.Write();
CommitTransaction();
Except
// In case of failure abort the current transaction and
// start the next attempt in a new transaction
RollbackTransaction();
EndTry;
EndDo;
BeginTransaction();
…
However, calls of this type do not start a new transaction within the current trans-
action.
IMPORTANT!
1C:Enterprise does not support nested transactions.
Chapter 9. Work with Data 1-515
It means the only active transaction is always the top-level transaction. All trans-
actions invoked within the open transaction belong to this transaction rather than
become nested transactions. Therefore, a rollback of a nested transaction ulti-
mately rolls back the entire top-level transaction rather than the nested transaction
only. At the same time commitment of a nested transaction is ignored.
Thus, greater isolation of transactions means more overhead and slow system
performance.
Transactions can be isolated using locks placed on the data used in transactions.
The level of isolation defines the lock types applied to various database objects
and the lock duration.
In 1C:Enterprise, you can work with data in one of two modes:
In a transaction
Outside a transaction
When you work with data outside the transaction, you are only allowed to
read the data. This approach ensures maximum speed and concurrency of
data read operations. Therefore, any data read operation outside the transaction
is unreliable. It means a read operation of this type can return obsolete data or
uncommitted changes made by another transaction, i.e. it does not account for data
locks set by other transactions.
When you work with data within a transaction, you can perform any data read and
modification operations.
You should follow the following rules:
Data read operations must be reproducible, i.e. any subsequent data read opera-
tion with the same selection criterion must return the same result;
The read operation result must contain the most recent data. It means no other
transaction can change the data read by the current transaction until the latter
is completed;
The read operation result must not include uncommitted changes of database
data.
data read operations in a transaction is not guaranteed). Therefore, in the managed
lock mode, the developer has to manage locks applied within transactions.
A summary of differences between the auto-lock and managed lock modes
is provided in the table below:
Lock Type Transaction Isolation Level
Auto-locks
File Database Tables Serializable
MS SQL Server Records Repeatable Read or Serializable
IBM DB2 Records Repeatable Read or Serializable
PostgreSQL Tables Serializable
Oracle Database Tables Serializable
Managed Locks
File Database Tables Serializable
MS SQL Server 2000 Records Read Committed
MS SQL Server 2005 and later Records Read Committed Snapshot
IBM DB2 Records Read Committed
PostgreSQL Records Read Committed
Oracle Database Records Read Committed
NOTE
It is recommended to develop applications in the managed lock mode to get the
most of your DBMS. Application automatic mode is used for compatibility with
previous application versions and it is not recommended for production opera-
tion.
The system behavior during irresponsive reading (e.g. when dynamic lists are used
or reports are made) also varies depending on the given lock mode. The table
below provides a summary of the differences of irresponsive reading in different
(automatic or managed) lock modes.
Reading outside the transaction
Automatic Lock
File database "Dirty" reading
MS SQL Server "Dirty" reading
IBM DB2 "Dirty" reading
PostgreSQL Consistent reading
Oracle Database Consistent reading
Managed Lock
File database "Dirty" reading
MS SQL Server 2000 "Dirty" reading
MS SQL Server 2005 and later Consistent reading
IBM DB2 "Dirty" reading
PostgreSQL Consistent reading
Oracle Database Consistent reading
1-518 1C:Enterprise 8.3. Developer Guide
Where <field name> – is a name of the field that can be used to set a managed
lock. A list of valid fields (that can be used to set a managed lock) shall be set
in the Data lock fields property for the following objects:
catalogs
documents
1-520 1C:Enterprise 8.3. Developer Guide
Please keep in mind that a single register record can be locked twice: first, you can
lock the record and then you can lock the set that owns this record.
Chapter 9. Work with Data 1-521
When an object for which the field lock is available is deleted or changed, locking
is performed by the Reference field and by all fields specified in the Data lock
fields property. If an object is changed, it is locked by "old" field values (which
existed before writing) and by "new" values (which are included in the object to be
written).
You can also pass the 1C:Enterprise script Range object as a value; this object
is created in the wizard and defines the upper and lower limits of the range (the
limit values are also included in the range).
If you use a data source, specify a value for the DataSource property and then
use the UseFromDataSource() method to map the lock namespace fields with the
data source fields:
Lock = New DataLock;
LockItem = Lock.Add("AccumulationRegister.GoodsInStock");
LockItem.DataSource = DocumentObject.Returnables;
LockItem.UseFromDataSource("Nomenclature", "Nomenclature");
LockItem.UseFromDataSource("Warehouse", "Warehouse");
In the shared lock mode, the locked data cannot be modified by another transaction
until the current transaction is completed.
1-522 1C:Enterprise 8.3. Developer Guide
In the exclusive lock mode, the locked data cannot be modified by another trans-
action until the current transaction is completed and cannot be read by another
transaction placing a shared lock on the same data.
Considering compatibility of actions within a transaction, you should remember
that in addition to explicit managed locks set by the user, 1C:Enterprise can also
set implicit managed exclusive locks as it writes data within the transaction.
When you read object data from the database (retrieve the object or follow a link),
transactional object lock is not applied. If you need the lock, you should use the
1C:Enterprise script to set it before calling the object.
Below is a table of compatibility for actions performed within a transaction when
the managed lock mode is used.
Lock Mode NL SL EL
R W R W R W
NL R + + + + + +
W + - - - - -
SL R + - + - - -
W + - - - - -
EL R + - - - - -
W + - - - - -
Where:
R – read
W – write
NL – no lock
SL – shared lock
EL – exclusive lock
The lock control mode is defined by the top-level transaction. In other words,
if by the time you initiate a transaction another transaction has been started, the
new transaction can only run in the mode specified for the running transaction.
Review the above peculiarities in more detail.
The first peculiarity is that the system places additional managed locks on the
data written in a transaction, even if the transaction already uses the automatic
lock control mode. It means transactions that run in the managed lock mode can
conflict with transactions executed in the automatic lock control mode.
The second peculiarity is that the lock control mode specified for a meta-
data object in the configuration or explicitly set at the transaction start
(in the BeginTransaction() method parameter) is only a recommended mode.
The actual lock control mode for a transaction depends on whether this transac-
tion call is the first or another transaction has already been initiated in the current
1C:Enterprise session.
For example, if you want to manage locks as you write register record sets and post
a document, the managed lock mode has to be placed on both the register and the
document, since register record sets will be written in a transaction opened when
you write the document.
Four combinations of lock control modes are valid in a transaction, as demon-
strated in the table below:
Existing Transaction Mode New Transaction Mode Result
Automatic Automatic The new transaction runs in the automatic
mode
Automatic Managed The new transaction runs in the automatic
mode
Managed Automatic An exception is raised
Managed Managed The new transaction runs in the managed
mode
Then analyze the query text generated in the module and create the required locks.
Exclusive Lock for GoodsInStock Register
When you run the record set module, a query is generated; it contains the
following fragment:
// …
LEFT JOIN
AccumulationRegister.GoodsInStock.Balance(,
Nomenclature IN (SELECT DISTINCT
Nomenclature
FROM
Document.GoodserviceSales.Goods
WHERE
Ref = &DocumentRef))
// …
LockGoodsInStock1 = Lock.Add("AccumulationRegister.GoodsInStock");
LockGoodsInStock1.Mode =
DataLockMode.Exclusive;
LockGoodsInStock1.DataSource = DocumentObject.Goods;
LockGoodsInStock1.UseFromDataSource("Nomenclature", "Nomenclature");
LockGoodsInStock1.UseFromDataSource("NomenclatureCharacteristic","NomenclatureCharacteristic");
LockGoodsInStock1.UseFromDataSource("Warehouse", "Warehouse");
// …
LEFT JOIN
AccumulationRegister.GoodsInReserveInStock.Balance(,
Nomenclature IN (SELECT DISTINCT
Nomenclature
FROM
Document.GoodserviceSales.Goods
WHERE
Ref = &DocumentRef))
// …
1-526 1C:Enterprise 8.3. Developer Guide
LockGoodsInReserveInStock1.Mode = DataLockMode.Shared;
LockGoodsInReserveInStock1.DataSource = DocumentObject.Goods;
LockGoodsInReserveInStock1.UseFromDataSource("Nomenclature", Nomenclature");
LockGoodsInReserveInStock1.UseFromDataSource("NomenclatureCharacteristic","NomenclatureCharacteristic");
LockGoodsInReserveInStock1.UseFromDataSource("Warehouse", "Warehouse");
LockGoodsToBeTransferredFromWarehouse1.Mode = DataLockMode.Shared;
LockGoodsToBeTransferredFromWarehouse1.DataSource = DocumentObject.Goods;
LockGoodsToBeTransferredFromWarehouse1.UseFromDataSource("Nomenclature", "Nomenclature");
LockGoodsToBeTransferredFromWarehouse1.UseFromDataSource(
"NomenclatureCharacteristic","NomenclatureCharacteristic");
LockGoodsToBeTransferredFromWarehouse1.UseFromDataSource("Warehouse", "Warehouse");
Document.GoodserviceSales.Returnables.Nomenclature
FROM
Document.GoodserviceSales.Returnables
WHERE
Document.GoodserviceSales.Returnables.Ref = &DocumentRef)
AND Quality = &New)
// …
LockGoodsInStock2 = Lock.Add("AccumulationRegister.GoodsInStock");
LockGoodsInStock2.Mode = DataLockMode.Exclusive;
LockGoodsInStock2.DataSource = DocumentObject.Returnables;
LockGoodsInStock2.UseFromDataSource("Nomenclature", "Nomenclature");
LockGoodsInStock2.UseFromDataSource("Warehouse", "Warehouse");
LockGoodsInStock2.SetValue("Quality", Catalogs.Quality.FindByCode("1"));
// …
LEFT JOIN
AccumulationRegister.GoodsInReserveInStock.Balance(,
Nomenclature IN (SELECT DISTINCT
Document.GoodserviceSales.Returnables.Nomenclature
FROM
Document.GoodserviceSales.Returnables
WHERE
Document.GoodserviceSales.Returnables.Ref = &DocumentRef)) AS Reserves
// …
LockGoodsInReserveInStock2.Mode = DataLockMode.Shared;
LockGoodsInReserveInStock2.DataSource = DocumentObject.Returnables;
LockGoodsInReserveInStock2.UseFromDataSource("Nomenclature", "Nomenclature");
LockGoodsInReserveInStock2.UseFromDataSource("Warehouse", "Warehouse");
1-528 1C:Enterprise 8.3. Developer Guide
LockGoodsToBeTransferredFromWarehouse2.Mode = DataLockMode.Shared;
LockGoodsToBeTransferredFromWarehouse2.DataSource = DocumentObject.Returnables;
LockGoodsToBeTransferredFromWarehouse2.UseFromDataSource("Nomenclature", "Nomenclature");
LockGoodsToBeTransferredFromWarehouse2.UseFromDataSource("Warehouse", "Warehouse");
After all the required locks are created, you must lock the data listed above:
Lock.Lock();
If the exclusive mode is set, no new sessions can be created with this infobase.
Moreover, the exclusive mode cannot be set if multiple sessions work with an
infobase. The exclusive mode does not support setting managed locks (and any
attempts to set them are ignored).
When working in the exclusive mode, you should always bear the following
in mind: if a background task is launched from the session that set the exclusive
mode, the background task launched "takes away" the exclusive mode from the
parent session. During a background task, the parent session cannot change any
data in an infobase. The exclusive mode will return to the parent session when the
launched background task is completed.
1-530 1C:Enterprise 8.3. Developer Guide
Chapter 10
The data composition system is intended for generation of 1C:Enterprise reports
based upon their declarative description. Using declarative descriptions for the
reports allows to do the following:
Create reports without any coding;
Create various report variants;
Specify user settings in various variants;
Use automatically generated view and settings forms for the reports;
Break down report's execution into stages;
Execute different stages of report generation on different machines;
Use components of the data composition system independently;
Modify the report's execution process programmatically;
Configure the report's structure;
Combine several tables in the report;
Create nested reports, etc.
Features of the data composition system are used in the following cases:
In dynamic lists (see page 1-369),
In preparing data for further processing (e.g., in data processors).
The main items of the data composition system are demonstrated on fig. 225.
The data composition schema describes the essence of data provided for reporting
(where to receive data from and how to manage data composition). It represents
a basis for report generation. It can contain:
Query text with the data composition system instructions
Description of several data sets
Description of available fields
Description of links between several data sets
Description of data receiving parameters
Description of field and group templates, etc.
The data composition settings describe everything a developer or a user can set
up in the specified data composition schema. They can include:
Filter
Ordering
Conditional appearance
Report structure (parts of the future report)
Data receiving parameters
Data output parameters, etc.
The data composition template represents a predefined description as to how
to create a report. It combines composition schemas and settings. It actually
results from applying specific settings to the composition schema and represents
a finished task for the composition processor to generate a report with the required
structure and specified settings.
Chapter 10. Data Composition System 1-533
The data composition result item is a set of items of the data composition result.
The data composition result does not exist as an independent logical entity, only
its items do. Items of the data composition result can be output to a spreadsheet
document for presentation to the end user or to other types of documents.
The data composition process consists of several stages, as shown on fig. 226.
The data composition schema can be created in the following ways:
Visually, using the data composition schema wizard
Visually, using any editor that allows editing XML text
Using a program with 1C:Enterprise script objects
Editing the data composition settings can use a number of dedicated
1C:Enterprise script objects and table box extensions.
Preparing to execute is a process of generating a data composition template.
This process generates queries required to obtain the data specified in the settings
and it also creates report area templates.
Data composition execution is a process of obtaining, aggregating and formatting
the data.
Output of data composition result: the obtained composition result can be output
to a document to be shown to the user. A report can be output in various formats.
The schema on fig. 227 below demonstrates the data composition system objects
used at different report generation stages in generalized view.
The data composition schema wizard can be used for creating the data composi-
tion schema.
The data composition settings composer can be used for editing settings of the
data composition system.
1-534 1C:Enterprise 8.3. Developer Guide
All expressions, described in the data composition schema, are written in the data
composition system expression language (see page 1-547).
Chapter 10. Data Composition System 1-537
data set includes the ExpAmount field; and the field data are retrieved from the
nested data sets with the ExpenseAmount data path.
Data Composition Schema Data Set Field
A data set can contain descriptions of fields available for this data set.
The data set fields are described in the DataSetFields property that contains
a value collection consisting of DataCompositionSchemaDataSetField items.
10.3.1.6. Parameters
The data composition schema contains a description of the data parameters.
The data parameters are described in the data composition schema parameters
property that contains a value collection consisting of DataCompositionSche-
maParameter items.
You can specify the parameter mandatory attribute and make the parameter obliga-
tory to fill. For example, using a combination of these attributes you can implement
a parameter which, if it is not entered, prevents generation of a report.
1-540 1C:Enterprise 8.3. Developer Guide
10.3.1.8. Templates
Templates to be used for outputting a field or a group can be described in the data
composition schema. When specifying a template for a field or a group, indicate
the name of the template described in this property.
Templates are described in the data composition schema templates property.
This property contains a value collection consisting of DataCompositionSche-
maTemplateDescription items.
Define links between the data sets. Create a link between PriceList and Balance
data sets and another link between PriceList and Sales data sets (see fig. 233).
If the data composition system describes a link between two data sets, the destina-
tion data set is considered dependent. The source data set is considered a parent
in relation to the dependent data set.
In the examples above, the Balance and Sales data sets are dependent.
The PriceList data set, on the other hand, is their parent.
There is no indication about the link type in the data composition schema.
All links are considered left external joins. I.e., a parent data set record is used
in the composition even if there are no records in the dependent set.
You can indicate the link type in the data composition template (see page 1-617).
The link type is generated by the template composer depending on the applied
global filters. If a global filter is applied to a dependent data set field, links
between this data set and its parents generated in the data composition template
(up to the top of the data set hierarchy) are Inner. It means that parent data set
records are included in the composition only if records are found in the dependent
data sets.
For example, if the user applies a global filter to the Warehouse field, the
PriceList and Balance data sets are bound by an inner link.
If a data set is dependent on a certain data set and the link allows using a param-
eter list, data from the dependent data set are obtained in portions of 1000 records.
If using the parameter list is not allowed in the link, records are obtained one by
one.
If dependent and parent data sets contain a field with the same name, this field
is obtained from the parent data set. In the examples provided, the Nomenclature
field is always obtained from the PriceList data set.
1-544 1C:Enterprise 8.3. Developer Guide
The unlinked data sets cannot contain fields with the same name if they do not have
the same parent with the given field. Thus, the Balance and Turnovers data sets
can contain the Nomenclature field, but they cannot both contain the Contractor
fields.
In the link description, fields from the source data set (the parent set) are used
in the source expression; fields from the destination data set (the dependent data
set) are used in the destination link expression. Thus, to describe a link between
the PriceList and Balance data sets, the Nomenclature expression in the
SourceExpression property uses the PriceList data set field, while the Nomen-
clature expression in the DestinationExpression property uses Balance data
set field.
Fields from unlinked data sets cannot be used in a single group and data sets with
the same parent are not considered linked. The only exception is total fields that
can be used in any group. In the example above, you cannot use the Warehouse
and Contractor fields in the same group. However, you can use CountBalance
and SumTurnover, because they are resource fields.
The data from a dependent data set cannot be obtained without obtaining the parent
set data. It means obtaining data from a dependent set automatically retrieves data
from the parent set (and all of its parents). In the above example, when you obtain
the Balance data set, data from the PriceList set is also retrieved.
If a group uses data sets from multiple data sets, iteration is performed in the
last dependent data set during composition. Thus, if a group uses fields of the
PriceList and Balance sets, iteration is performed in the Balance set.
If no field from the linked data set is used in the settings, the data set is not
included in the data composition template.
Description:
This clause describes the fields that can be selected by the user for output.
This keyword is followed by comma-separated field aliases from the main
query selection list that are available for setup.
A field alias can be followed by a combination of ".*" characters that imply
child fields of this field can be used.
Thus, Nomenclature.* means Nomenclature child fields (e.g., Nomencla-
ture.Code) can be used. The SELECT element can only be included in the first
query of a union.
Example:
{SELECT Nomenclature, Warehouse}
WHERE
Description:
It describes the fields where the user can apply filtering. This clause uses table
fields. Selection list field aliases are not allowed. Each union part can contain its
own WHERE element.
If no parameter values are specified, the WHERE clause is no included in the
resulting query.
Example:
{WHERE Nomenclature.*, Warehouse }
{WHERE Document.Date >= &BeginDate, Document.Date <= &EndDate}
CHARACTERISTICS
Description:
In order to support work with characteristics in the query language extension
for the data composition system, characteristics description syntax has been
introduced.
The above example describes the characteristics of Ref fields in the Nomen-
clature catalog.
Characteristics describe the following properties:
TYPE – the name of the type for which characteristics are described;
1-546 1C:Enterprise 8.3. Developer Guide
Parameters
Description:
Besides the main elements, the data composition system can receive elements
written in virtual table parameters. In this case the field type depends on the
type of the parameter that contains the elements.
Chapter 10. Data Composition System 1-547
Line
Description:
A string literal is enclosed in double quotation marks (").
1-548 1C:Enterprise 8.3. Developer Guide
If you need to use double quotation marks (""") within a string literal, use two
double quotation marks.
Example:
"Literal""in quotation marks"""
Number
Description:
A number is written without spaces, in decimal format. Its fractional part
is separated by a period (".").
Example:
10.5
200
Date
Description:
A date literal is written using the DATETIME keyword. This keyword
is followed by a year, month, day, hours, minutes, and seconds separated by
commas. It is not necessary to specify the time.
Example:
January sixth, 1975
DATETIME(1975, 1, 06)
Boolean
Description:
Boolean values may be written with True and False literals.
Value
Description:
To specify literals of other types (system enumerations, preset data), use the
Value keyword followed by the literal name in brackets.
Example:
VALUE(AccountType.Active)
Chapter 10. Data Composition System 1-549
Fields
Description:
Expressions may contain dataset fields. A field is identified by a data path.
Parts of a data path are separated by ".". Field names are not case sensitive. If
a data path contains an identifier with spaces or special characters, such identi-
fiers should be enclosed in brackets.
Example:
Nomenclature.Articul
Sales.AmountTurnover
Sales.[Amount turnover]
Parameters
Description:
Expressions may use parameters. To use a parameter in an expression, write
its name preceded by &.
Example:
&Contractor
&StartDate
Type
Description:
Creates a value of type Type. A type is set with the help of the Type keyword.
Example:
Type("String")
Description:
This operation changes the sign of a number to its opposite.
Example:
-Sales.Count
1-550 1C:Enterprise 8.3. Developer Guide
Unary "+"
Description:
This operation does not perform any actions with the number.
Example:
+Sales.Count
Binary "-"
Description:
This operation calculates the difference between two numbers.
Example:
BalanceAndTurnovers.OpeningBalance - BalanceAndTurnovers.ClosingBalance
BalanceAndTurnovers.OpeningBalance - 100
400 - 357
Binary "+"
Description:
This operation calculates a total of two numbers.
Example:
BalanceAndTurnovers.OpeningBalance + BalanceAndTurnovers.Turnover
BalanceAndTurnovers.OpeningBalance + 100
400 + 357
Multiplication "*"
Description:
This operation multiplies two numbers.
Example:
Nomenclature.Price * 1.2
2 * 3.14
Division "/"
Description:
This operation divides one operand by another.
Example:
Nomenclature.Price / 1.2
2 / 3.14
Chapter 10. Data Composition System 1-551
LIKE
Description:
This operation checks if a string matches the transferred template.
The value of the LIKE operator is True if the Expressions value matches the
template or False otherwise.
The following characters in a template line have a meaning that is different
from their meaning in a simple sequence of characters:
"%" (per cent): a sequence containing zero and more random characters.
"_" (underscore): one random character;
"[…]" (one or multiple characters in square brackets): one character of those
in the square brackets. Ranges can be listed as well, such as a-z. This means
a random character within the range, both ends of the range included;
"[^…]" (square brackets containing a negation character followed by one or
multiple characters): any character but those that follow the negation character;
Any other character represents itself only and does not have any additional use.
If you need to use one of the above characters as a simple character, it should
be preceded by ESCAPE.
For instance, the template below means a substring that consists of a sequence
of characters:
letter A
letter B
1-552 1C:Enterprise 8.3. Developer Guide
letter C
one number
one of the letters: a, b, c or d
an underscore
letter a
letter b
letter c
The sequence may start anywhere within a string.
Example:
"%ABC[0-9][abcd]\_abc%" ESCAPE "\"
Description:
This operation is intended to compare two operands for equality.
Example:
Sales.Contractor = Sales.NomenclatureMainSupplier
Less (<)
Description:
This operation is intended to check that the first operand is less than the second
one.
Example:
CurrentSales.Total < PreviousSales.Total
Chapter 10. Data Composition System 1-553
Greater (>)
Description:
This operation is intended to check that the first operand is greater than the
second one.
Example:
CurrentSales.Total > PreviousSales.Total
Operation (IN)
Description:
This operation is intended to check the presence of a value in the list of passed
values. The operation returns True if the value is found or False otherwise.
Example:
Nomenclature IN (&Product1, &Product2)
NOT operation
Description:
NOT operation returns True, if its operand is equal to False, and it returns
False, if its operand is equal to True.
Example:
NOT Document.Consignee = Document.Shipper
AND operation
Description:
AND operation returns True, if both operands are TRUE, and False, if one of the
operands is False, for instance:
Example:
Document.Consignee = Document.Shipper AND Document.Consignee = &Contractor
OR operation
Description:
OR operation returns True, if one of the operands is True, and False, if both
operands are False.
Chapter 10. Data Composition System 1-555
Example:
Document.Consignee = Document.Shipper OR Document.Consignee = &Contractor
SUM
Syntax:
Total (Expression)
Description:
The Total aggregate function calculates a total of expression values passed
as an argument for all detailed records. You can pass Array as a parameter.
In this case the function will be applied to the array content.
Example:
TOTAL(Sales.SumTurnover)
COUNT
Syntax:
Count(Expression)
Description:
The Count function calculates the number of non-NULL values. You can pass
Array as a parameter. In this case the function will be applied to the array
content.
Example:
COUNT(Sales.Contractor)
COUNT (DISTINCT)
Syntax:
Count(Distinct expression)
Description:
This function calculates the number of different values. To obtain different
values, specify Distinct before the Count method parameter. You can pass
Array as a parameter. In this case the function will be applied to the array
content.
1-556 1C:Enterprise 8.3. Developer Guide
Example:
COUNT(Distinct Sales.Contractor)
MAX
Syntax:
Max(Expression)
Description:
This function obtains the maximum value. You can pass Array as a parameter.
In this case the function will be applied to the array content.
Example:
MAXIMUM(Balance.Count)
MIN
Syntax:
Minimum(Expression)
Description:
This function gets the minimum value. You can pass Array as a parameter.
In this case the function will be applied to the array content.
Example:
MINIMUM(Balance.Count)
AVG
Syntax:
Avg(Expression)
Description:
This function gets the mean value for non-NULL values. You can pass Array as
a parameter. In this case the function will be applied to the array content.
Example:
AVERAGE(Balance.Count)
ARRAY
Syntax:
Array([Distinct] Expression)
Description:
This function creates an array that includes an expression value for each detailed
record.
Chapter 10. Data Composition System 1-557
You can use a value table as a parameter. Note that in this case the function
results in an array containing the values of the first column of the value table
passed as a parameter.
If an expression includes the Array function, this expression is considered to
be an aggregate expression.
If the Distinct keyword is specified, the retrieved array will not include
duplicate values.
Example:
ReportFunctions.StandardDeviation(Array(Sum))
VALUETABLE
Syntax:
ValueTable([Distinct] Expression1 [AS ColumnName1][, Expres-
sion2 [AS ColumnName2]], ...])
Description:
The function generates a table of values with the number of columns equal to
the number of function parameters. Detailed records are retrieved from data sets
that are required to compute all the expressions specified as function parameters.
If residual fields are used as function parameters, the resulting value table
will include values for the entries by unique sets of measurements from other
periods. Note that values are only obtained for residual fields, measurements,
accounts, period fields and their attributes. The values of other fields in the
entries from other periods are considered NULL.
If an expression includes the ValueTable function, this expression is consid-
ered to be an aggregate expression.
If the Distinct keyword is specified, the retrieved value table will not include
rows with duplicate data.
Use the AS keyword that follows an expression used in order to create
a column value to specify a name for each column.
Example:
ReportFunctions.ValueTableToString(ValueTable(Inventory AS Inventory, QuantityBalance AS Balance))
GROUPBY
Syntax:
GroupBy(<Expression>, <ColumnNumbers>)
Description:
This function removes duplicates from an array.
1-558 1C:Enterprise 8.3. Developer Guide
Parameters:
<Expression>
Type: Array or ValueTable. Duplicates are deleted for the value located in this
formal parameter.
<ColumnNumbers>
String type. Is used if the Expression parameter is of the ValueTable type.
Numbers or names (comma-separated) of the value table columns where dupli-
cates should be searched for. By default, this includes all columns.
Example:
GroupBy(ValueTable(PhoneNumber, Address) ,"PhoneNumber").
GETPART
Syntax:
GetPart(<Expression>, <ColumnNumbers>)
Description:
The function obtains a value table that contains specific columns from the
original value table.
Parameters:
<Expression>
Type: ValueTable. The table of values that the columns should be retrieved
from.
<ColumnNumbers>
String type. Numbers or names (comma-separated) of the value table columns
that should be retrieved.
Returned value:
A table of values that contains only the columns specified in ColumnNumbers
parameter.
Example:
GetPart(GroupBy(ValueTable(PhoneNumber, Address) ,"PhoneNumber"),"PhoneNumber").
ORDER
Syntax:
GroupBy(<Expression>, <ColumnNumbers>)
Description:
Intended to order the items of an array and value table.
Chapter 10. Data Composition System 1-559
Parameters:
<Expression>
Type: Array or ValueTable. An object to be ordered.
<ColumnNumbers>
Is used if the Expression parameter is of the ValueTable type. Numbers or
names (comma-separated) of the value table columns that should be ordered.
By default, this includes all columns.
Order direction or an automatic ordering attribute may be placed after each
column.
Returned value:
An array or a table of values ordered in accordance with the transferred param-
eters.
Example:
Order(ValueTable(PhoneNumber, Address, CallDate),"CallDate Desc").
JOINSTRINGS
Syntax:
JoinStrings(<Values>, <ItemSeparator>, <ColumnSeparator>)
Description:
Intended to join multiple strings into a single string.
Parameters:
<Values>
Values, the string presentations of which should be joined into a single string.
If it is an Array, array items will be joined into a string. If it is a ValueTable,
all the table columns and rows will be joined into a string.
<ItemSeparator>
String type. Contains a text to be used as a separator between array items and
the rows of a value table. By default, it is a line feed character.
<ColumnSeparator>
String type. Contains a text to be used as a separator between the columns
of a value table. By default it is ";".
Returned value:
Joined string.
Example:
JoinStrings(ValueTable(PhoneNumber, Address)).
1-560 1C:Enterprise 8.3. Developer Guide
GROUPPROCESSING
Syntax:
GroupProcessing(<Expressions>, <HierarchyExpressions>,
<GroupName>)
Description:
A table of values is created that contains the parameter values (in columns)
for each group entry (in rows). If hierarchical grouping is used, each hierarchy
level is processed separately. The values of hierarchical records are also
included in a data table. In a returned object, this table of values will be located
in the Data property.
The CurrentItem property will hold the row (of the value table being trans-
ferred) for which the function is currently calculated.
When implementing a function that can take group processing data as param-
eter, please note that NULL value can be transferred to the function as a value.
This may happen, for instance, if the GroupProcessing() function is calcu-
lated and the name of the group that is currently unavailable is specified.
Parameters:
<Expressions>
The string listing the comma-separated expressions to be calculated. Each
expression may be followed by the optional AS keyword and a column name of
the resulting value table. Each expression describes a column of the value table
being created.
<HierarchyExpressions>
The expressions to be calculated for hierarchical records. This is similar to
the Expressions parameter with the only difference being that Expressions
parameter is used for non-hierarchical records, and HierarchyExpressions
is used for hierarchical records. If the parameter is omitted, the expressions
specified in the Expression parameter are used to calculate the values for
hierarchical records.
<GroupName>
Name of the group to calculate processing grouping in. If this is omitted, calcu-
lations are carried out in the current grouping. If a calculation is performed
on a table and the parameter includes a null string or is blank, the value
is calculated for the row grouping. When the data composition template
is generated, the template composer replaces this name with the grouping name
in the resulting template. If the grouping is not available, the function will be
replaced with NULL.
Chapter 10. Data Composition System 1-561
Returned value:
DataCompositionGroupProcessingData object.
Example:
An example of how the ABCClassification() function can be implemented.
This function returns 1 if the value reaches 75% of the total amount; 2,
if it reaches between 75% and 95%; and 3 in other cases.
// Calculate ABC classification.
Function ABCClassification(Data) Export
Var ValueTable;
EndIf;
EndLoop;
EndIf;
If CommonAmount = 0 Then
Percent = 1;
1-562 1C:Enterprise 8.3. Developer Guide
Else
EndIf;
Data.ProcessingTempData.Insert("ABCClassificationValueTable", ValueTable);
Data.ProcessingTempData.Insert("ABCClassificationIndexOfClassA", IndexOfClassA);
Data.ProcessingTempData.Insert("ABCClassificationIndexOfClassB", IndexOfClassB);
EndIf;
// GroupTotal.
Null is returned;
Else
Null is
returned;
Else
Index = ValueTable.Index(String);
1 is returned;
2 is returned;
Else
3 is returned;
EndIf;
EndIf;
EndIf;
EndFunction
Chapter 10. Data Composition System 1-563
EVERY
Syntax:
Every(<X>)
Description:
The Every aggregate function determines whether a set transferred contains at
least one False value.
Returned value:
True – if the set transferred contains no False value.
False – if the set transferred contains at least one False value.
ANY
Syntax:
Any(<X>)
Description:
The Any aggregate function determines whether a set transferred contains at
least one True value.
Returned value:
True – if the set transferred contains at least one True value.
False – if the set transferred contains no True value.
STDDEV_POP
Syntax:
STDDEV_POP(<X>)
Description:
Calculates a standard deviation of the general aggregate of the set transferred.
Calculation is based on the following formula: SQRT(VAR_POP(X)).
Returned value:
Result.
STDDEV_SAMP
Syntax:
STDDEV_SAMP(<X>)
1-564 1C:Enterprise 8.3. Developer Guide
Description:
Calculates a standard deviation of a selection of the set transferred.
The calculation is based on the following formula: SQRT(VAR_SAMP(X)).
Returned value:
Result.
VAR_SAMP
Syntax:
VAR_SAMP(<X>)
Description:
Calculates the selected dispersion for the set transferred.
Calculation is based on the following formula: (SUM(X^2)-SUM(X)^2/
COUNT(X))/(COUNT(X)-1). If the number of entries in a set is equal to 1
(COUNT(X)=1), the returned value is NULL.
Returned value:
Result.
VAR_POP
Syntax:
VAR_POP(<X>)
Description:
Calculates a general aggregate dispersion for the set transferred. NULL values
are ignored.
The calculation is based on the following formula: (SUM(X^2)-SUM(X)^2/
COUNT(X))/(COUNT(X)).
Returned value:
Result.
COVAR_POP
Syntax:
COVAR_POP(<Y>, <X>)
Description:
Calculates the covariation of aggregated multiple pairs of the sets transferred.
Chapter 10. Data Composition System 1-565
CORRELATION
Syntax:
Correlation(<Y>, <X>)
Description:
Calculates the covariation coefficient of multiple pairs of the sets transferred.
Calculation is based on the following formula: COVAR_POP(Y,X)/(STDDEV_
POP(Y)*STDDEV_POP(X)). Pairs that have at least one NULL value are ignored.
Returned value:
The result of calculation or NULL if the function is applied to empty sets.
REGR_SLOPE
Syntax:
RegressionSlope(<Y>, <X>)
Description:
Calculates the line slope.
Calculation is based on the following formula: Covar_Pop(Y,X)/Var_Pop(X).
Pairs that have at least one NULL value are ignored.
1-566 1C:Enterprise 8.3. Developer Guide
Returned value:
Result.
REGR_INTERCEPT
Syntax:
REGR_INTERCEPT(<Y>, <X>)
Description:
Calculates the Y intercept of the regression line.
Calculation is based on the following formula: Average(Y)- Regr_Slope
(Y, X) * Average(X). Pairs that have at least one NULL value are ignored.
Returned value:
Result.
REGR_COUNT
Syntax:
REGR_COUNT(<Y>, <X>)
Description:
Calculates the number of pairs without NULL.
Returned value:
Result. 9
REGR_R2
Syntax:
REGR_R2(<Y>, <X>)
Description:
Calculates a determination coefficient for the regression. The function
is calculated without taking into account value pairs that contain NULL value.
Returned value:
NULL, if Var_Pop(X) is equal to 0.
1, if Var_Pop Y) is 0 and Var_Pop(X) is not equal to 0.
Pow(Corr(Y,X),2), if Var_Pop(Y) is more than 0 and Var_Pop(X) is not
equal to 0.
REGR_AVGX
Syntax:
REGR_AVGX(<Y>, <X>)
Chapter 10. Data Composition System 1-567
Description:
Calculates an average of independent variables <X> for a regression line after
the pairs where at least one value is NULL are excluded.
The calculation is based on the following formula: Average(X).
Returned value:
Result.
REGR_AVGY
Syntax:
REGR_AVGY(<Y>, <X>)
Description:
Calculates an average of dependent variables <Y> for a regression line after the
pairs where at least one value is NULL are excluded.
The calculation is based on the following formula: Average(X).
Returned value:
Result.
REGR_SXX
Syntax:
REGR_SXX(<Y>, <X>)
Description:
Performs a calculation using the following formula: Regr_Count(Y, X) *
Var_Pop(X). Pairs that have at least one NULL value are ignored.
Returned value:
Result.
REGR_SYY
Syntax:
REGR_SYY(<Y>, <X>)
Description:
Performs a calculation using the following formula: Regr_Count(Y, X) *
Var_Pop(Y). Pairs that have at least one NULL value are ignored.
Returned value:
Result.
1-568 1C:Enterprise 8.3. Developer Guide
REGR_SXY
Syntax:
REGR_SXY(<Y>, <X>)
Description:
Performs a calculation using the following formula: Regr_Count(Y, X) *
Covar_Pop(Y, X). Pairs that have at least one NULL value are ignored.
Returned value:
Result.
RANK
Syntax:
Rank(<Order>, <HierarchyOrder>, <GroupName>)
Description:
The function defines which place the current record should take among the
current group records if sorted in the order specified in the function’s parame-
ters. Numbering starts at 1.
Parameters:
<Order>
String type. Contains statements that should have their comma-separated
group records ordered in their sequence. The ordering direction is managed by
Asc, Desc words. The field may also be followed by AutoOrder string which
means that ordering fields specified for the referenced object should be used
for reference ordering. If the sequence is not specified, the value is calculated
in the grouping sequence.
<HierarchyOrder>
String type. A string that contains ordering expressions for hierarchical
records.
<GroupName>
String type. Name of the group in which to calculate the function.
If omitted, calculations are carried out in the current grouping. If the calculation
is performed in a table, and the parameter contains an empty string or is not
specified, the value is calculated for a group string. When the data composi-
tion template is generated, the template composer replaces this name with the
grouping name in the resulting template. If the grouping is not available, the
function will be replaced with NULL.
Chapter 10. Data Composition System 1-569
Returned value:
Ordered number. If a sequence includes multiple records with identical values
of ordering fields, the function will return identical values for all such records.
CLASSIFICATIONABC
Syntax:
ClassificationABC(<Value>, <GroupCount>, <PercentageFor-
Groups>, <GroupName>)
Description:
Performs an ABC classification of each record in the group.
Parameters:
<Value>
String type. Specifies a value for which the classification should be calcu-
lated.
<GroupCount>
Type: Number. The number of groups into which to separate a value set.
<PercentsForGroups>
String type. The volume (%) of each split group, except for the last one.
Listed in a row and separated by comma.
<GroupName>
String type. Name of the group in which to calculate the function.
If omitted, calculations are carried out in the current grouping. If a calculation
is performed on a table and the parameter includes a null string or is blank,
the value is calculated for the rows grouping. When the data composition
template is generated, the template composer replaces this name with
the grouping name in the resulting template. If the grouping is not available,
the function will be replaced with NULL.
Returned value:
Class number 1 corresponds to class A, 2 – class B, 3 – class C, etc.
Example:
ClassificationABC(SumTurnover, 3, "15, 25")
1-570 1C:Enterprise 8.3. Developer Guide
10.3.4.11. Functions
EVAL
Syntax:
Eval(<Expression>,<Grouping>,<CalculationType>)
Description:
The Eval function is used to evaluate expressions within a certain grouping.
Parameters:
<Expression>
A string that contains the expression to be calculated.
<Grouping>
A string that contains the name of a grouping within which the expression is to
be evaluated. If an empty string is used as a grouping name, the evaluation
will be performed within the context of the current grouping. If the Overall
string is used as a grouping name, the evaluation will be performed within the
context of the grand total. Otherwise, the evaluation will be performed in the
context of the parent grouping with this name.
<CalculationType>
A string that contains a type of calculation. If this parameter is Overall,
the expression will be evaluated for all the records of the grouping. When the
parameter value is Grouping, the values will be calculated for the current
group record of the grouping.
1-572 1C:Enterprise 8.3. Developer Guide
Example:
Total(Sales.SumTurnover) / EVAL("Total(Sales.SumTurnover)", "Overall")
In this example, the result will be the ratio of the total by the Sales.SumTurn-
over field of the grouping record to the total of the same field in the entire
composition.
EVALEXPRESSION
Syntax:
EvalExpression(<Expression>, <Grouping>, <Calculation-
Area>, <Begin>, <End>, <Sorting>, <HierarchicalSorting>,
<ProcessingSimilarOrderValues>)
Description:
The function is used to evaluate expressions within a certain grouping.
The function takes filters of the groups into account but ignores hierarchical
filters.
The function cannot be applied to a group in a group filter for this group. For
example, in a filter of the Nomenclature group you should not use the expres-
sion EvalExpression("Total(SumTurnover)", , "Overall") > 1000.
However, this expression can be used in a hierarchical filter.
If the end record is located before the beginning one, there are considered to be
no records to calculate the detailed data and aggregate functions.
When you calculate the interval expressions for overalls (the Grouping param-
eter is Overall), there are considered to be no records to calculate the detailed
data and aggregate functions.
When the template composer generates an expression for the EvalExpression
and the sorting expression contains fields that can be used in a grouping, the
EvalExpression function is replaced with NULL.
Parameters:
<Expression>
String type. An expression to be calculated.
<Grouping>
String type. Contains a name of a grouping within which the expression is to
be evaluated. If an empty string is used as a grouping name, the evaluation
will be performed within the context of the current grouping. If the Overall
string is used as a grouping name, the evaluation will be performed within the
context of the grand total. Otherwise, the evaluation will be performed in the
context of the parent grouping with this name.
Chapter 10. Data Composition System 1-573
Example:
Total(Sales.SumTurnover) / Eval("Total(Sales.SumTurnover)", "Overall")
In this example, the result will be the total of the Sales.SumTurnover field of
the grouping record divided by the total of the same field in the entire compo-
sition.
<CalculationArea>
String type. The parameter may take the following values:
Overall – the expression is calculated for all group entries.
Hierarchy – the expression should be calculated for the parent hierarchical
record, if any, or for the entire group if there is no parent hierarchical
record.
Grouping – the expression is calculated for the current group record of the
grouping.
GroupingNotResource – when the function is calculated for a group
record by resources, the expression will be calculated for the first group
record of the original grouping.
When the EvalExpression() function is calculated with the Grou-
pingNotResource value for group records that are not grouped by
resources, the function is calculated in the same manner as it is calculated
with Grouping for the parameter value.
When a data composition template is created to output fields of the
resource to group by to the template, data composition template composer
puts an expression calculated via EvalExpression() function to the
template and specifies NotResourceGroup parameter. For the remaining
resources, standard resource expressions are added to the group by resource.
<Start>
String type. Specifies which record should be used to begin the portion where
the aggregate expression functions should be calculated and what record should
be used to retrieve field values outside of aggregate functions. It can take the
following values:
First. The first record of the group should be retrieved. The word may
be followed by an expression in brackets with the result used as a shift
from the group beginning. The resulting value should be a positive integer.
Example: First(3) means that the third value from the group beginning
is retrieved.
If the first record is outside of the group, there are considered to be no
records. For example, when there are 3 records and you need to retrieve
First(4), it is assumed that there are no records.
1-574 1C:Enterprise 8.3. Developer Guide
from the group beginning. The resulting value should be a positive integer.
For example: First(3) means that the third value from the group’s start
is retrieved.
If the first record is outside of the group, there are considered to be no
records. For example, when there are 3 records and you need to retrieve
First(4), it is assumed that there are no records.
Last. The last record of the group should be retrieved. The word may
be followed by an expression in brackets with the result used as a shift
from the group end. The resulting value should be a positive integer.
For example: Last(3) means that the third value from the group end
is retrieved.
If the last record is outside of the group, there are considered to be no
records. For example, when there are 3 records and you need to retrieve
Last(4), it is assumed that there are no records.
Previous. The previous record of the group should be retrieved. The word
may be followed by an expression in brackets with the result used as a shift
back from the current record of the group. For example: Previous(2)
retrieves the record that is located prior to the previous one.
If the previous record is outside of the group (e.g., for the second group
record you need to get Previous(3)), the first group record is retrieved.
When the previous record for a group total is retrieved, the first record
is retrieved.
Next. The next record of the group should be retrieved. The word may
be followed by an expression in brackets with the result used as a shift
forward from the current record of the group. For example: Next(2)
retrieves the record that follows the next one.
If the next record is outside of the group, there are considered to be no
records. For example, when there are 3 records and you need to retrieve
Next() for the third record, it is assumed that there are no records.
When the next record for a group total is retrieved, there are considered to
be no records.
Current. The current record should be retrieved.
When you are retrieving for a group total, the first record is retrieved.
BoundaryValue. A record should be retrieved based on a specified
value. The BoundaryValue keyword may be followed by an expression
in brackets with its value used to end the portion of the first sorting field.
The first record that has its sorting field equal to or greater than the speci-
fied value will be retrieved as a record. For example, if Period is used as
a sorting field, its values are 01/01/2010, 02/01/2010, 03/01/2010, and you
need to retrieve BoundaryValue(DateTime(2010, 1, 15)), the record
with the date 02/01/2010 will be retrieved.
1-576 1C:Enterprise 8.3. Developer Guide
<Sorting>
String type. Lists comma-separated expressions that describe ordering rules.
If not specified, ordering is performed in the same way as in the group for
which the expression is evaluated. The Asc (to sort by ascending order) or
Desc (to sort by descending order) and AutoOrder (to order reference fields by
the fields to be used to sort a referenced object) keywords can be used after
each expression. AutoOrder can be used both with the Asc and Desc keywords.
<HierarchicalSorting>
String type. Similar to Sorting parameter. Used to sort hierarchical records.
If missing, the template composer generates a sorting based on the value in the
Sorting parameter.
<ProcessingSimilarOrderValues>
String type. Sets the rule to define a previous or a next record if there are
several records with the same ordering value:
Separately – means that a sequence of sorted records is used to deter-
mine the previous and next records. This is the default value.
Together – means that the previous and next records are defined based on
the sorting expression values.
For example, if a retrieved sequence is sorted by date:
№ Date Full name Value
1 January 01, 2001 M. Ivanov 10
2 January 02, 2001 S. Petrov 20
3 January 02, 2001 R. Sidorov 30
4 January 03, 2001 S. Petrov 40
If you need to obtain a grouping value in the previous line, use the following
expression:
EvalExpression ("Rate", , , "Previous")
EVALEXPRESSIONWITHGROUPARRAY
Syntax:
EvalExpressionWithGroupArray (<Expression>, <GroupFieldsEx-
pressions>, <RecordsFilter>, <GroupFilter>)
Description:
The function retrieves an array with every item containing the result of calcu-
lating the expression for the group by the specified field.
When the template composer generates a template, it converts function param-
eters into data composition template field terms. For example, the Contractor
field will be converted into DataSet.Contractor.
When the template composer generates expressions to output a custom field
with an expression containing only EvalArrayWithGroupArray(), it will
generate the required expression so that the data display presentations are
sorted. For example, for a custom field with the expression:
EvalExpressionWithGroupArray("Total(SumTurnover)", "Contractor")
Parameters:
<Expression>
String type. An expression to be calculated. A string, for instance
Total(SumTurnover).
1-578 1C:Enterprise 8.3. Developer Guide
<GroupFieldsExpression>
String type. Group field expressions are comma-separated expressions of the
group fields. For example: Contractor, Batch.
<RecordsFilter>
String type. An expression that describes a filter applied to detailed records.
For example, DeletionMark = False.
<GroupFilter>
String type. An expression that describes a filter applied to group records.
For example: Total(SumTurnover) > &Parameter1.
Example:
Maximum(EvalExpressionWithGroupArray ("Total(SumTurnover)", "Contractor")).
EVALEXPRESSIONWITHGROUPVALUETABLE
Syntax:
EvalExpressionWithGroupValueTable (<Expressions>, <GroupFi-
eldsExpressions>, <RecordsFilter>, <GroupFilter>)
Description:
The function retrieves a table of values with every row containing the result of
calculating the expressions for the group by the specified field.
When the template composer generates a template, it converts function param-
eters into data composition template field terms. For example, the Contractor
field will be converted into DataSet.Contractor.
When the template composer generates expressions to output a custom field
with an expression containing only EvalArrayWithGroupValueTable(),
it will generate the required expression so that the data display presentations
are sorted. For example, for a custom field with the expression:
EvalExpressionWithGroupValueTable ("Contractor, Total(SumTurnover)", "Contractor")
Parameters:
<Expressions>
String type. The expressions to be calculated. The string may list multiple
comma-separated expressions. Each expression may be followed by an optional
AS keyword and the name of a value table column. For example: Contractor,
Total(SumTurnover) AS SalesVolume.
<GroupFieldsExpression>
String type. Group field expressions are comma-separated expressions of the
group fields. For example: Contractor, Batch.
<RecordsFilter>
String type. An expression that describes a filter applied to detailed records.
For example, DeletionMark = False.
<GroupFilter>
String type. An expression that describes a filter applied to group records. For
example: Total(SumTurnover) > &Parameter1.
Example:
EvalExpressionWithGroupValueTable ("Contractor AS Contractor, Total(SumTurnover) AS SalesVolume", "Contractor")
The result of this function is a table of values that has columns named
Contractor and SalesVolume that will contain contractors with their respec-
tive volumes of sales.
LEVEL
Description:
This function is intended to retrieve the current record level.
Example:
LEVEL()
LEVELINGROUP
Description:
The function is used to retrieve the level of an entry in relation to the group
root.
Example:
LEVELINGROUP()
1-580 1C:Enterprise 8.3. Developer Guide
VALUEISFILLED
Description:
Returns True, if the value differs from the value of another default type,
differs from NULL, from an empty link, and the Undefined value. NULL value
is checked for logical values. Strings are checked to verify whether they
contain any non-spacing characters.
SERIALNUMBER
Description:
This function retrieves the next sequence number.
Example:
SERIALNUMBER()
GROUPSERIALNUMBER
Description:
This function returns the next sequence number in the current grouping.
Example:
GROUPSERIALNUMBER()
FORMAT
Description:
This function retrieves a formatted string of the transferred value. The format
string defined in compliance with the 1C:Enterprise format string.
Parameters:
Value
Format string
Example:
FORMAT(Invoices.SumDoc, "NFD=2")
BEGINOFPERIOD
Description:
This function is intended to extract a specific date from a given date.
Chapter 10. Data Composition System 1-581
Parameters:
Expression of type Date.
Type of period – a string that contains one of the following values: Minute,
Hour, Day, Week, Month, Quarter, Year, Decade, HalfYear.
Example:
BEGINOFPERIOD(DateTime(2002, 10, 12, 10, 15, 34), "Month")
Result:
01.10.2002 0:00:00
ENDOFPERIOD
Description:
This function is intended to extract a specific date from a given date.
Parameters:
Expression of type Date.
Type of period – a string that contains one of the following values: Minute,
Hour, Day, Week, Month, Quarter, Year, Decade, HalfYear.
Example:
ENDOFPERIOD(DateTime(2002, 10, 12, 10, 15, 34), "Week")
Result:
13.10.2002 23:59:59
DATEADD
Description:
This function is used to add a value to a date.
Parameters:
Expression of type Date.
Type of increment – a string that contains one of the following values:
Second, Minute, Hour, Day, Week, Month, Quarter, Year, Decade,
HalfYear.
Size – specifies the value of date increment. Number type. Fractions are
ignored.
Example:
DATEADD(DateTime(2002, 10, 12, 10, 15, 34), "Month", 1)
1-582 1C:Enterprise 8.3. Developer Guide
Result:
12.11.2002 10:15:34
DATEDIFF
Description:
This function is intended to obtain the difference between two dates.
Parameters:
Expression of type Date.
Expression of type Date.
Type of difference – one of the values: Second, Minute, Hour, Day, Month,
Quarter, Year.
Example:
DATEDIFFERENCE(DATETIME(2002, 10, 12, 10, 15, 34),
DATETIME(2002, 10, 14, 9, 18, 06),
"DAY")
Result:
2
CURRENTDATE
Description:
Returns system data. When a composition template is composed in all
the expressions present in the composition, the CurrentDate() function
is replaced with the current date value.
Example:
CURRENTDATE()
SUBSTRING
Description:
This function extracts a substring from a string.
Parameters:
An expression of string type.
The position of the character where the substring starts.
The length of the extracted substring.
Chapter 10. Data Composition System 1-583
Example:
SUBSTRING(Contractors.Address, 1, 4)
STRINGLENGTH
Description:
This function defines the string length. The parameter is a string type expres-
sion.
Example:
STRINGLENGTH (Contractors.Address)
YEAR
Description:
This function extracts a year from a Date value. The only parameter is an
expression of type Date.
Example:
YEAR(Invoice.Date)
QUARTER
Description:
This function extracts a quarter number from a Date value. As a rule,
a quarter number is between 1 and 4. The only parameter of the function is an
expression of type Date.
Example:
QUARTER(Invoice.Date)
MONTH
Description:
This function is intended to obtain a month number from a Date value. As
a rule, a month number is between 1 and 12. The only parameter of the func-
tion is an expression of type Date.
Example:
MONTH(Invoice.Date)
1-584 1C:Enterprise 8.3. Developer Guide
DAYOFYEAR
Description:
This function retrieves the day of the year from a Date value. The day of the
year is normally in the range from 1 to 365 (366). The only parameter of the
function is an expression of type Date.
Example:
DAYOFYEAR(Invoice.Date)
DAY
Description:
This function retrieves the day of the month from a Date value. As a rule,
a day number is between 1 and 31. The only parameter of the function is an
expression of type Date.
Example:
DAY(Invoice.Date)
WEEK
Description:
This function retrieves the week number in a year from a Date value. Weeks
of the year are numbered starting with 1. The only parameter of the function
is an expression of type Date.
Example:
WEEK(Invoice.Date)
WEEKDAY
Description:
This function retrieves the day of the week from a Date value. The day of
the week is normally in the range from 1 (Monday) to 7 (Sunday). The only
parameter of the function is an expression of type Date.
Example:
WEEKDAY(Invoice.Date)
HOUR
Description:
This function retrieves the hour (in 24-hour format) from a Date value.
As a rule, the hour of the day is between 0 and 23. The only parameter of the
function is an expression of type Date.
Chapter 10. Data Composition System 1-585
Example:
HOUR(Invoice.Date)
MINUTE
Description:
This function retrieves the minute number from a Date value. As a rule, the
minute of the hour is between 0 and 59. The only parameter of the function
is an expression of type Date.
Example:
MINUTE(Invoice.Date)
SECOND
Description:
This function retrieves the second in a minute from a Date value. The number
of second is between 0 and 59. The only parameter of the function is an
expression of type Date.
Example:
SECOND(Invoice.Date)
CAST
Description:
This function extracts a type from an expression that can contain a compound
type. If the expression contains a type other than the required one, the NULL
is returned.
Parameters:
Expression transformed
Type – a string that contains a type string. For example, Number, String,
etc. In addition to primitive types, the string can also contain a table name.
In this case the function attempts to cast to the table reference.
Example:
CAST(Data.Attribute1, "Number(10,3)")
ISNULL
Description:
This function returns the second parameter value if the first parameter is NULL.
Otherwise, the first parameter value is returned.
1-586 1C:Enterprise 8.3. Developer Guide
Example:
ISNULL(Total(Sales.SumTurnover), 0)
PRESENTATION
Syntax:
Presentation(<Expression>)
Description:
This function retrieves the string presentation of the non-primitive type value
delivered. The value itself is returned for primitive values.
If an array is transferred as a parameter, the function returns a string
containing string presentations of all the array items separated by ";". If a value
table is transferred as a parameter, the function returns a string that contains
string presentations of all value table strings, and cell presentations of each row
are separated by ";", while the rows are separated with a line feed character.
If an item has an empty string presentation, a string reading <Empty value>
is displayed instead of its presentation.
Example:
Presentation(Contractor)
STRING
Syntax:
String(<Expression>)
Description:
If an array is transferred as a parameter, the function returns a string
containing string presentations of all the array items separated by ";". If a value
table is transferred as a parameter, the function returns a string that contains
string presentations of all value table strings, and cell presentations of each row
are separated by "; ", while the rows are separated with a line feed character.
If an item has an empty string presentation, a string reading <Empty value>
is displayed instead of its presentation.
Example:
String(SaleDate)
ACOS
Syntax:
ACos(<X>)
Description:
Calculates the arccosine value.
Chapter 10. Data Composition System 1-587
ASIN
Syntax:
ASin(<X>)
Description:
Calculates the arcsine value.
ATAN
Syntax:
ATan(<X>)
Description:
Calculates the arctangent value.
COS
Syntax:
Cos(<X>)
Description:
Calculates the cosine value.
SIN
Syntax:
Sin(<X>)
Description:
Calculates the sine value.
TAN
Syntax:
Tan(<X>)
Description:
Calculates the tangent value.
EXP
Syntax:
Exp(<X>)
Description:
Calculates e raised to the power of X.
LOG
Syntax:
Log(<X>)
1-588 1C:Enterprise 8.3. Developer Guide
Description:
Calculates a natural log value.
LOG10
Syntax:
Log10(<X>)
Description:
Calculates a common log value.
POW
Syntax:
Pow(<X>, <Y>)
Description:
Calculates X raised to the power of Y.
SQRT
Syntax:
Sqrt(<X>)
Description:
Calculates a square root value.
ROUND
Syntax:
Round(<Expression>, <CharacterCount>)
Description:
Rounds off the Expression value to CharacterCount after the comma.
INT
Syntax:
Int(<Expression>)
Description:
Calculates the cosine value.
VALUETYPE
Syntax:
ValueType(<Expression>)
Description:
Calculates a type of expression transferred as a parameter.
Returned value:
A value of type Type.
Chapter 10. Data Composition System 1-589
An example of how the data composition schema wizard window opens and the
obtained composition schema is serialized in XML is shown below:
Wizard.Edit(ThisObject);
EndProcedure
DataCompositionSchema = Source.GetSchema();
XMLWriter = New XMLWriter;
XMLWriter.SetString();
XDTOSerializer.WriteXML(
XMLWriter, DataCompositionSchema,
"dataCompositionScheme",
"http://v8.1c.ru/8/data-composition-system/scheme");
FormElements.DataCompositionSchemaText.SetText(XMLWriter.Close());
EndIf;
EndProcedure
Work with the data composition schema is divided into the following stages:
Editing data sets
Editing data set fields
Editing data set links
Editing calculated fields
Editing resources
Editing parameters
Editing templates
Editing nested settings
Editing data composition system settings
SELECT
GoodsReceipt.Date,
GoodsReceipt.Number,
GoodsReceipt.Vendor,
GoodsReceipt.Warehouse,
GoodsReceipt.Goods.(
LineNumber,
Product,
Price,
Count,
Sum
)
{SELECT
Date,
Number,
Vendor.*,
Warehouse.*,
Goods.(
LineNumber,
Product.*,
Price,
Count,
Sum
)}
FROM
Document.GoodsReceipt AS GoodsReceipt
{WHERE
GoodsReceipt.Date,
GoodsReceipt.Number,
GoodsReceipt.Vendor.*,
GoodsReceipt.Warehouse.*,
GoodsReceipt.Goods.(
LineNumber,
Product.*,
Price,
Count,
Sum
)}
Code fragments in bold in the above example describe nested table fields that are
available for setup.
Synonyms are only retrieved for the query fields that either have no alias or have an
alias that is different from the default alias.
The following method is used to obtain synonyms for a query field:
If the query has no unions:
○○ If the query field expression includes a single field, the synonym
is retrieved from this field;
○○ If the field expression is an aggregate function of a single field, the field
synonym is retrieved from this field. For other expressions, obtaining
a synonym is considered impossible.
If the query has unions:
○○ All unions are searched for the field that allows obtaining a synonym
which is then used as the field synonym. If no field is found, obtaining
a synonym is considered impossible.
The data composition schema wizard includes an additional column with a check
box that indicates that the field header is manually set. The check box is cleared
by default if the field has no header.
When filling fields based on a query, the wizard auto-fills headers for the fields
that either cannot obtain a synonym or have an alias that is different from the
default alias. Thus, the check box is auto-selected for these fields.
If this check box is deselected, the Title column displays the header to be displayed
to the user. However, the field header is not actually filled in this case. The Title
column for the fields with the deselected check box is not editable and highlighted
as unavailable.
If the developer wants to change the header, he/she can enable the check box; the
field header is filled based on the text previously displayed in the Title column.
When the check box is cleared, the wizard clears the query text and displays auto-
generated text in the header.
The field role is initially defined in the query, but can be changed in a separate
dialog box (see fig. 242).
The account field requires am explicit reference to the account type in the Type
parameter.
The dimension field can have a path to the parent dimension data indicated in the
Dimension parameter.
If the Ignore NULL values flag is set, it means the result will not include group
records for the field if its value is NULL.
The resulting data set always includes fields with the Required flag set if at least
one field of the data set is used in the settings. For example, if you want to obtain
split balance for extra dimensions, but the ExtDimensions field is not used in the
query, the balance is not split.
Chapter 10. Data Composition System 1-595
The field's order expression, value type and appearance can also be edited
in a separate dialog box.
Data sets act as link sources and destinations. The source and destination expres-
sions are data set fields.
Accessibility restriction
Presentation expression
Order expressions
Value type
Appearance
Available values
Order expressions are edited in a separate dialog box.
By default the Sum function is set for numeric fields and the Count function –
for non-numeric fields. Use the >> button to add all fields of the Number type to
the resources. You can also enter multiple rows for a single resource. When the
template composer obtains an expression for a resource, it uses information about
the target group and displays the corresponding expression.
In the Calculate by… column edit dialog, for fields for which hierarchical grouping
is possible, strings with a field name and Hierarchy keyword are added.
The expression will be used for hierarchical grouping records for the field specified
before the keyword. When a group is selected in the context of which a resource
can be calculated, you can simultaneously select both a usual and a hierarchical field.
If a resource can only be calculated for a certain group (i.e. its Calculate by…
column contains at least one group), then this resource is output to the result for
this group and its nested groups only.
Chapter 10. Data Composition System 1-597
If a parameter value is undefined, it is seen as a zero reference to the set type.
Parameters can include predefined data and enumerations (the Designer mode).
The Available values column is used to edit values that can be selected by the user
as data composition schema parameters. If the List of values is available check box
is selected, it means multiple parameter values can be used.
NOTE
If the StandardPeriod parameter type is used, please note that the start and
end dates of a standard period also contain time values. The start date contains
00:00:00 as its time value, while the end date contains 23:59:59. Thus, the
BEGINOFPERIOD and ENDOFPERIOD functions are no longer required in a query.
1-598 1C:Enterprise 8.3. Developer Guide
A template can be edited in any language supported in the system. If a parameter
or a template is assigned to a spreadsheet document cell, parameters are added to
the template and displayed in the Parameter name column of the Template Param-
eters table box. Template parameter expressions can be edited. When a template
is loaded, its areas are separated by empty rows.
10.3.5.9. Settings
A data composition schema contains default data composition settings that can be
specified by the developer.
The Auto position of resources report settings control how resource fields are
displayed:
Do not use – in this case resources are shown in the order in which fields are
listed in the Selected fields tab.
After all fields – in this case resources are displayed after all fields.
A group (or a table group) has the Grouping use case parameter that controls how
additional information is displayed after resource fields. If this parameter is not set
or is set to Auto, the group is responsible for showing detailed records.
If this parameter is set to Additional information for a column group, the result table
in this column will show one column with the fields listed in the Selected fields
tab of this group that are available for display in a row group. If group fields are
set for the column group, an error will occur when the data composition template
is generated. The same applies for a row group, except that one row is shown
instead of a column.
For example, Nomenclature is shown in table rows. And warehouses are shown
in table columns. A report on inventory at warehouses is generated. It is neces-
sary to show the nomenclature article after columns with the inventory. To do this,
add a table group to the columns without group fields and set the Grouping use
case parameter to Additional information in group settings. In the Selected fields
tab, specify the Nomenclature.Article field.
When such a group is shown outside the table, all fields available in the group are
displayed.
Thus, if a report contains a group with multiple nested groups, you can use
a group with the Grouping use case parameter set to Additional information to
display parent group data between the groups.
The following parameters are ignored for groups with the Additional information
usage option:
Group Fields Location – field titles shown in a group are always displayed at
the beginning of a row/column.
Records number.
Records percent.
Totals placement.
Grouping field placement.
Grouping placement.
Grand totals placement.
When the data template is composed, if a group with the Additional information
usage option uses a field that is not available in the group or a table and it is not
available for any group, an exception is called.
Chapter 10. Data Composition System 1-601
Nested Fields
The system automatically generates nested fields for numeric resources. These
fields are calculated by the system and simplify generation of different indicators,
for example, a resource percentage of a resource values sum in all report data.
These fields include:
% in hierarchical group
Identifier:
PercentInHierarchy
Description:
This field shows the resource percentage in the current hierarchical group.
When the field is shown outside the table, the value is 100%.
% in a column or a point hierarchical group
Identifier:
PercentInColumnOrPointHierarchy
Description:
This field shows the current cell resource value percentage of the resource total
value in the current hierarchy level of the current column/point group. When
the field is shown outside the table, the value is % in hierarchy group.
% in a row or a series hierarchical group
Identifier:
PercentInRowOrSeriesHierarchy
Description:
This field shows the current cell resource value percentage of the resource total
value in the current hierarchy level of the current row/series group. When the
field is shown outside the table, the value is 100%.
% in a group
Identifier:
GroupPercent
Description:
This field shows the current cell resource value percentage of the resource total
value in the current group. When the field is shown outside the table, the value
is 100%.
1-602 1C:Enterprise 8.3. Developer Guide
System Fields
The system generates a special system field group in the list of selected fields.
These are used to determine the record sequence number both for the whole report
and a separate group. Note that system fields are not included in the list of fields
with auto fields when expanding, so they have to be added manually.
Ser. #
Identifier:
SystemFields.SerialNumber
Description:
Shows the row sequence number in the given report. Numeration always starts
from 1.
# in group
Identifier:
SystemFields.GroupSerialNumber
Description:
Shows the row sequence number in the current group. Numeration always
starts from 1.
Level
Identifier:
SystemFields.Level
Description:
Shows the current record's level. Numeration always starts from 1.
Level in group
Identifier:
SystemFields.LevelInGroup
Description:
Shows the current record's level relative to the group. Numeration always starts
from 1.
Parameter Fields
There is a special group in selected fields, Parameters, that can be used to add
data composition schema parameters with Include in available fields checked to
a report.
1-604 1C:Enterprise 8.3. Developer Guide
Group
To implement a group, three different data types are used in the settings structure:
Groups (DataCompositionGroup)
Table groups (DataCompositionTableGroup)
Chart groups (DataCompositionChartGroup)
Use of three types is explained by the requirement to implement limitations on
the mutual position of items in the structure tree: tables and plans cannot contain
anything except groups. Correspondingly, all group objects have a similar object
Chapter 10. Data Composition System 1-605
model; they are distinguished by types of nested value collection and contents of
output parameters.
Group Fields
A set of fields used for grouping is described in the DataCompositionGro-
upFields object. The Items property of this object contains a group field collec-
tion consisting of DataCompositionGroupField objects.
NOTE
When grouping by the period field, a parent period field which is not an addi-
tional period is automatically added to the group if grouping by this parent period
field was not performed in the parent groups.
For example, if grouping is performed by the Recorder field, then the SecondPe-
riod field is automatically added to the group.
Creation of groups by period field attributes is not allowed.
Autogroup Field
An auto-field is converted to a set of group fields before use.
The procedure used to generate the set is described below. The selected used
fields meeting the following criteria are chosen:
The fields are available to be used in the group fields.
They are not resources.
They are not dependent on other selected fields.
They are not dependent on the existing group fields.
If a field is already included in the group field data, it is not added again.
Table
A table description in the settings structure is performed using the DataComposi-
tionTable object.
Chart
A chart description in the settings structure is performed using the DataComposi-
tionChart object.
Nested Object
A nested object description in the settings structure is performed using
the DataCompositionNestedObjectSettings object.
The Name property is implemented for the object. This property is used to iden-
tify a nested report within the generated data composition template.
1-606 1C:Enterprise 8.3. Developer Guide
The Format and Text parameters are edited as multilingual in the data composi-
tion appearance of the data composition wizard.
For an element of conditional appearance, you can specify to which areas such
conditional appearance should be applied.
To a field output in the grouping
To a field output in a hierarchical grouping
To a field output in total
To field headers
To a report header area
To the area where report parameters are output
To the area where filter values are output
Appearance Fields
These are fields with applied appearance. They are described using the DataCom-
positionAppearanceFields object. The Items property of this object contains
a collection of appearance fields consisting of DataCompositionAppearan-
ceField objects. If no fields are indicated, appearance is applied to the entire area.
Output Parameters
Output parameter values define object appearance. Inheritance is supported for
some parameters. It means the output parameter collection for an item can contain
parameters that do not belong to the item, but are used in items that can be inserted
in a subordinate settings structure.
Data Parameters
Data parameter values are usually used in queries for selection filtering.
User Fields
User fields allow the user to extend a set of the used available fields by defining
custom expressions or variant sets with the condition of using a specified variant.
User fields are described using the DataCompositionUserFields object.
The Items property of this object contains a collection of user fields consisting of
two object types:
Expression field (DataCompositionUserFieldExpression object)
Case field (DataCompositionUserFieldCase object)
The system defines the field type automatically based on its properties.
User Field Variants
It is a description of alternatives set that defines case field value. They are
described using the DataCompositionUserFieldsCaseVariants object.
Chapter 10. Data Composition System 1-609
The Items property of this object contains a collection of user case field variants
consisting of DataCompositionUserFieldsVariant objects.
Work with Auto-Fields
If a settings structure item contains DataCompositionAutoGroupField,
DataCompositionAutoSelectedField and DataCompositionAutoOrderItem
auto-fields, they are converted as follows:
DataCompositionAutoGroupField
DataCompositionAutoSelectedField
DataCompositionAutoOrderItem
The user item setup form can be used to specify that the item is a user item, select
its presentation and edit mode.
The Custom settings item propertiy command can be used to set up user settings for
the current structure item in the settings structure list. Each structure item has got
its own list of adjustable items.
Object Adjustable Items
Report ■■ Selected fields
■■ Order
■■ Filter
■■ Conditional appearance
■■ List of group
Group/ ■■ Group
table group/ ■■ Selected fields
chart group ■■ Filter
■■ Order
■■ Conditional appearance
■■ List of nested groups
Chart ■■ Chart
■■ Selected fields
■■ Conditional appearance
■■ List of series groups
■■ List of point groups
Table ■■ Table
■■ Selected fields
■■ Conditional appearance
■■ List of row groups
■■ List of column groups
Nested schema ■■ Nested report
■■ Selected fields
■■ Filter
■■ Order
■■ Conditional appearance
■■ List of groups
Depending on the call source, the Properties command of a user settings item
can be used to modify various settings:
Filter list – user settings for the current item/filter groups,
List of output and data parameters – user settings for the current parameter,
Conditional appearance list – user settings for the current conditional appear-
ance item.
Chapter 10. Data Composition System 1-613
Additionally the Custom Settings command of the structure table can open a modal
form that displays user settings with their default values.
TIP
It makes sense to designate settings as user settings (out of the various settings
provided by the data composition system) if they are meant for report manage-
ment by the end user. It is assumed that the user will only operate these settings.
For example, a query (functioning as a data set for the report) might contain many
fields that can be used for filtering. However, the report developer believes there
is a number of filter items that are used most frequently. Therefore, it is logical
they can be designated as user settings. In this case the user can edit both "special"
filter items (the Goods Item row on fig. 253) and the entire filter (the Filter row
on fig. 253).
It also makes sense to designate the following settings as user:
Period or date – virtually or all reports
Groups and conditional appearance – for spreadsheet reports
Account value – for accounting reports, etc.
For each report, the developer makes a decision as to what settings need to be
designated as user settings in this report (or report variant).
The table used to edit user settings also has got the ViewMode property that defines
whether all user settings or quick settings only are displayed.
If a user does not like the current quick user settings, they can change their content,
such as exclude settings that will not be changed very often.
The user needs to run the More – Change settings assortment… (All actions –
Change settings assortment…) command in the report settings edit window.
The left side of the form shows all the user settings that can be selected as quick
settings, and the right side shows the settings currently being edited in the report
form.
Filter editing forms and conditional appearance forms contain commands to edit the
user settings item properties. Thus, the user can drag filter or conditional appear-
ance items that are frequently modified to quick user settings.
You can also manage quick user settings in the settings edit form using the
Edit in report form column. By default this is not shown in the form. You need
Chapter 10. Data Composition System 1-615
to enable it using the All actions – Change form... command in the edit settings
window.
In this case you can't add new settings, but you can quickly change existing settings.
Data Sources
The data composition template can contain several data source descriptions.
A data source means a source from where data are retrieved. 1C:Enterprise
infobase is used as a data source.
Data sources are described in the template's DataSources property that contains
a value collection consisting of DataCompositionTemplateDataSource items.
Several data sources that specify one infobase using a connection string can be
created.
1-618 1C:Enterprise 8.3. Developer Guide
Data Sets
The data composition template data sets contain a description of the data to be
obtained in data composition.
They are described in the data composition template's DataSets property.
Several data sets can exist.
Nested data sets are treated as standard data sets. They are always associated with
their parents. If a filter condition is specified for a nested data set, its association
with the parent data set is considered inner.
Data Composition Template Data Set Field
A data set can contain descriptions of fields available for this data set. Fields with
no descriptions in data sets are not available. If a certain field is present in a data
set query but does not exist in the data set fields description, this field is not avail-
able for use.
Data set fields are described in the data set's Fields property that contains a value
collection consisting of DataCompositionTemplateDataSetField items.
Data Composition Template Parameter Values
The data composition template can contain parameters in any of its expressions.
Parameter values are described in the data composition template's Para-
meterValues property that contains a value collection consisting of DataCompo-
sitionTemplateParameterValue items.
Data Composition Template Data Set Links
Data sets within the data composition template can be linked. The data composi-
tion template describes links between data sets.
Data set links are described in the data composition template's DataSetLinks
property that contains a value collection consisting of DataCompositionTem-
plateDataSetLink items.
Area Templates in Data Composition Template
During composition execution, area templates are output to the composition result.
These area templates are also stored in the data composition template.
Templates are described in the data composition template's Templates property
that contains a value collection consisting of DataCompositionTemplateAr-
eaTemplateDefinition items.
Data Composition Template Body
The previous sections of the data composition template specify where to receive
information. Indication of how to compose data is in the data composition
template body. The data composition template body consists of separate items.
Chapter 10. Data Composition System 1-619
Table Group
It describes a table group and is represented by the 1C:Enterprise script DataCom-
positionTemplateTableGroup object.
A table group contains the same properties as an ordinary group, with the following
differences:
Table group body and table group hierarchical body can only contain items
included in the table body, i.e. only table groups, table detail records and table
group templates. The hierarchical body can also contain a table hierarchical
group that indicates a location where hierarchical group records are output;
Table group templates are used as header and footer templates;
The following properties can be used:
○○ OverallsTemplate – specifies the template used to output overalls by
groups and having the DataCompositionTemplateTableGroupTemplate
type.
○○ OverallsPlacement – describes the overalls placement for a group and
has the DataCompositionTotalPlacement type.
Table Detail Records
They describe table detail records and are represented by the 1C:Enterprise script
DataCompositionTemplateTableRecords object.
Table Group Template
A table group template describes templates used for outputting table groups and
is represented by the 1C:Enterprise script DataCompositionTemplateTab-
leGroupTemplate object.
Chart Group
It describes chart groups and is represented by the 1C:Enterprise script DataCom-
positionTemplateChartGroupBody object.
A chart group contains the same properties as an ordinary group, with the following
differences:
The chart group body and chart group hierarchical body can only contain chart
group templates and chart groups. The hierarchical body can also contain
1-620 1C:Enterprise 8.3. Developer Guide
Area Templates
An area template is a declarative description of the output data position as well
as the visual presentation required for the output of data to differently formatted
documents.
There are several fundamentally different area templates:
The area template itself
Plan area templates
The template structure is shown on fig. 257.
A table cell is a rectangular area used for outputting data in differently formatted
documents. Cells can contain output fields, text and formatting.
Template Item Collection
A template item collection (DataCompositionAreaTemplateItems object)
is a collection of fields (DataCompositionAreaTemplateField objects). These
objects can appear in the collection in an arbitrary order. Data in these objects
is used for outputting to differently formatted documents.
Field
This item is a field output in a table cell or list item. A field can contain an arbi-
trary value and its appearance. A field is described by the 1C:Enterprise script
DataCompositionAreaTemplateField object.
Table Cell Appearance
Table cell appearance is a collection of objects that describe the formatting of
a table cell. It is described by the 1C:Enterprise script DataCompositionAr-
eaTemplateTableCellAppearance object.
Field Appearance
Field appearance is a collection with a single object – the Format appearance
item. It is described by the 1C:Enterprise script DataCompositionAreaTem-
plateFieldAppearance object.
the parameter name to the Value property of the data composition area field
(DataCompositionAreaTemplateField object). Add the parameter itself to the
template definition parameter list and assign it a parameter name and a name of
the output field or expression in the data composition system expression language
as its expression.
Chart Template
A chart template is used for describing the chart type. It is described by the
1C:Enterprise script DataCompositionAreaTemplateChartTemplate object.
Chart Resource Template
A chart resource template is used for generating chart values and is described by
the 1C:Enterprise script DataCompositionAreaTemplateChartResourceTem-
plate object.
Chart Group Template
A chart group template is used to generate chart points and series. It is described
by the 1C:Enterprise script DataCompositionAreaTemplateChartGroupTem-
plate object.
If you want to output several group levels in the report, create an appropriate
number of subordinate areas for each listed area containing levels. To create an
area level, specify the area and press the Add command bar button. A row named
Level N is added to the area list, where N stands for the group level number. Set
appearance for the group level as described above.
NOTE
If several levels are set and a group level is removed, the lowest level in the
current area is always deleted, even if another one is selected in the list.
Appearance Template Structure
Every appearance template consists of a certain number of appearance template
areas. An appearance template area has a name – a string listing the appearance
template areas and specifying for which area the given template is to be used and
an appearance item collection.
An appearance item has two properties:
Level – a positive number; if the level is 0, the appearance is considered to be
applied by default to all templates of an area of a certain type;
Appearance – a collection containing the appearance property names and their
values.
Appearance templates are represented by the 1C:Enterprise script DataComposi-
tionAppearanceTemplate object.
1-624 1C:Enterprise 8.3. Developer Guide
Table Template
The following group of templates is generated for a table:
Table header template. This template contains the names of the output table
row fields, as in the example below.
Contractor Contractor.Code
Nomenclature Nomenclature.Code Nomenclature.Description
Template of totals by rows. This template contains the Total special word and
names of the resource fields if they are output horizontally, as in the example
below.
Total
Count Sum
Template of totals by columns. This template contains the Total special word
and names of the resource fields if they are output vertically, as in the example
below.
Total Count
Sum
Overalls template. This template contains the resource fields that are output
in the table and are required to display the overalls in a table, as in the
example below.
Presentation(Sum(Sales.SalesVolume)) Presentation(Sum(Sales.SalesVolume))
Location of the template data within the table is shown below.
Table Header Column area Total template by rows
Row area Resource area Totals area by rows
Total template by columns Totals area by columns Template of overalls
The location of the totals templates by columns and rows is managed by the
OverallsHorizontalLocation and OverallsVerticalLocation properties,
respectively. The following options of the overalls location are possible:
None – overalls are not output.
Table Header Column area
Begin – overalls are output in the first column or in the first row of a table,
respectively.
Table Header Total template by rows Column area
Total template by columns Template of overalls Totals area by columns
Row area Totals template by rows Resource area
End – overalls are output in the last column or the last row of a table, respec-
tively.
Table Header Column area Total template by rows
Row area Resource area Totals area by rows
Total template by columns Totals area by columns Template of overalls
BeginAndEnd – overalls are output in the first column/row and in the last
column/row of a table.
Table Header Total template by rows Column area Total template by rows
Total template Template of overalls Totals area by columns Template of overalls
by columns
Row area Totals area by rows Resource area Totals area by rows
Total template Overalls template Totals area by columns Template of overalls
by columns
Auto – column totals are located in the last row, whilst row totals are located
in the last column.
Chart Template
This template contain the chart's appearance properties.
template type, then the selected fields are located vertically, otherwise horizon-
tally.
○○ Horizontal – location of the selected fields is horizontal, from left to right.
Contractor Contractor.Code
Nomenclature Nomenclature.Code Nomenclature.Description
Alex-2002 00009
1C:Accounting 8 00013 1C:Accounting 8
○○ Vertical – location of the selected fields is vertical, one under another.
Contractor Alex-2002
Contractor.Code 00009
Nomenclature 1C:Accounting 8
Nomenclature.Code 00013
Nomenclature.Description 1C:Accounting 8
Location of output fields. There are two types of fields: output fields (owner
fields and/or their attributes) and resource fields. The output of these fields
have considerable differences:
○○ Output of fields. As mentioned above, there are owner fields
and attribute fields. Owner fields are output in an area template
in accordance with their sequence order in the data composi-
tion setting. Location of attribute fields is managed by a special
AttributePlacement parameter of the DataCompositionOut-
putParameterValues object. The following location options are possible:
□□ Together – attribute fields are located together in a separate column and
are separated by a comma when they are output.
Contractor Contractor.Code
Nomenclature Nomenclature.Code, Nomenclature.Description
Contractor
Nomenclature Nomenclature attributes
Nomenclature.Code
Nomenclature.Description
Nomenclature.MainSup
Chapter 10. Data Composition System 1-629
Unfilled cells are located under the filled cells. Cells that are located below are
merged with the cells above.
Unfilled cells are located to the right and under the filled cells. Cells that are
located to the right are merged with the cells on the left. Then cells that are
located below are merged with the cells above.
Data object is placed and the appearance template. This method returns the
created data composition template.
The template composer:
creates a composition template;
modifies the data set queries for obtaining the information the user requires and
places them in the composition template;
generates filters in the query text or the data set description;
if necessary, creates data sets for obtaining and checking the hierarchy;
creates the required parameters with values set by the user in the data composi-
tion template;
fills in body items of the data composition template, in which it places groups,
tables, etc. and fills in their parameters;
uses the template area generator (see page 1-624). If an appearance template
is specified (parameter № 4), this template is applied to the generated template;
creates the DetailsData object and places it in the passed variable if param-
eter № 3 is specified. The created object should be used in the composition
processor and in processing the details.
When the data composition template compiler generates a data composition
template it analyzes the Group parameter value of the EvalExpression() func-
tion. If the parameter contains a name of the group that exists in the settings, the
template compiler does not change this name. Otherwise, the template compiler
searches in the current group's parent groups for the group with group fields
containing all the fields specified in the Group parameter of the EvalExpres-
sion() function and then puts the name of the group found in this parameter.
For example, if the Nomenclature, NomenclatureCharacteristic string
is specified as the parameter for the EvalExpression() function, then during the
template generation the template compiler locates a group for the Nomenclature
and NomenclatureCharacteristic fields and places the name of the group
found into the generated template. The group is searched in groups that are avail-
able in the place where the group is evaluated. Thus, when the template compiler
generates an expression for a table cell, the group will be searched in column
groups for which a cell is displayed; row groups for which a cell is displayed;
and groups in which a table is nested. Groups to which the EvalExpression()
function can be applied are found in this way. If multiple groups are found, the
closest group is selected. In a table, a group is searched in a row, then in a
column, and then a group is searched above the table.
If the group is not found, the expression is replaced with NULL.
Actually, this allows you to use EvalExpression() in user fields by specifying
groups by group field names rather than by names alone.
1-632 1C:Enterprise 8.3. Developer Guide
Example:
DataCompositionschema = GetDataCompositionschema();
ExcutableSettings = GetExcutableSettings();
TemplateComposer = New DataCompositionTemplateComposer;
CompositionTemplate = TemplateComposer.Execute(DataCompositionSchema, ExecutableSettings);
The created data composition template can be used for execution, i.e. for obtaining
the result.
DCTemplate = GetCompositionTemplate();
OutputProcessor =
New DataCompositionResultSpreadsheetDocumentOutputProcessor;
OutputProcessor.SetDocument(FormElements.SDResultSpreadsheetDocument;
OutputProcessor.BeginOutput();
While True Do
DCResultItem = DataCompositionProcessor.Next();
If DCResultItem = Undefined Then
Abort;
EndIf;
OutputProcessor.OutputItem(DCResultItem);
EndDo;
OutputProcessor.EndOutput();
When the data composition process is initialized, the following can be specified:
External data set object: a structure that contains the external data set name as
its key and a data set as its value;
Details data: an object where drill down information is placed;
Chapter 10. Data Composition System 1-633
External function use feature: a flag that indicates whether functions of the
configuration's common modules can be used.
from the setting. This functionality allows the user to replace unavailable fields by
other fields or to remove their use from the settings.
If the AutoFillCheck parameter is set to True when the Execute() method of
the DataCompositionTemplateComposer object is executed, the system checks
whether fields are available to the current user and whether a field exists in an
enabled functional option. If the settings use an unavailable field, an exception
is raised. If the parameter is False, no check is performed.
NOTE
If a report is execute from an auto-generated form, the system checks whether
fields are available to the current user and whether a field exists in an enabled
functional option.
Property Value
Item type Begin
Templates TableHeader,
ColumnHeader,
RowHeader,
Resources
Placement of nested items Vertically
Item 2
Property Value
Item type Beginning
Placement of nested items Horizontally
Item 3
Property Value
Item type BeginEnd
Template name TableHeader
Chapter 10. Data Composition System 1-635
Item 4
Property Value
Item type BeginEnd
Template name ColumnHeader
Item 5
Property Value
Item type End
Item 6
Property Value
Item type Begin
Placement of nested items Horizontally
Item 7
Property Value
Item type BeginEnd
Template name RowHeader
Item 8
Property Value
Item type BeginEnd
Template name Resources
Item 9
Property Value
Item type End
Item 10
Property Value
Item type End
The output result for such items must look like the following:
TableHeader ColumnHeader
RowHeader Resources
The result items can be saved in XML using the standard tools, as shown in the
example below.
XMLWriter = New XMLWriter;
XMLWriter.SetString();
XMLWriter.WriteStartElement("result");
DataCompositionTemplate = GetCompositionTemplate();
While True Do
DataCompositionResultItem = DataCompositionProcessor.Next();
If DataCompositionResultItem = Undefined Then
Abort;
EndIf;
XDTOSerializer.WriteXML(XMLWriter, DataCompositionResultItem,
"item", "http://v8.1c.ru/8/data-composition-system/scheme");
EndDo;
XMLWriter.WriteEndElement();
FormElements.DataCompositionResult. SetText(XMLWriter.Close());
DataCompositionTemplate = GetCompositionTemplate();
OutputProcessor = New
DataCompositionResultValueCollectionOutputProcessor;
OutputProcessor.SetDocument(FormElements.SDResultSpreadsheetDocument;
OutputProcessor.BeginOutput();
While True Do
DataCompositionResultItem = DataCompositionProcessor.Next();
If DataCompositionResultItem = Undefined Then
Abort;
EndIf;
OutputProcessor.OutputItem(DataCompositionResultItem);
EndDo;
OutputProcessor.EndOutput();
Chapter 10. Data Composition System 1-637
You can also use the Output() method of the OutputProcessor object. Specify
DataCompositionProcessor as a method parameter. In this case layout result
output appears as follows:
OutputProcessor.Output(DataLayoutProcessor);
The data composition processor freezes the table tile if one table or one group
is shown in the report (possibly with nested groups). You can manage the fixation
(left and top) using the output setting FixedLeft and FixedTop.
OutputProcessor = New
DataCompositionResultValueCollectionOutputProcessor;
OutputProcessor.SetObject(ResultTree);
OutputProcessor.BeginOutput();
While True Do
DataCompositionResultItem = DataCompositionProcessor.Next();
If DataCompositionResultItem = Undefined Then
Abort;
EndIf;
OutputProcessor.OutputItem(DataCompositionResultItem);
EndDo;
OutputProcessor.EndOutput();
1-638 1C:Enterprise 8.3. Developer Guide
The following limitations exist for layout result output to a value table or tree:
Settings must only contain groups and detail records. No tables, charts or nested
reports are allowed;
All folders specified in the selected fields are ignored;
Neither conditional appearance nor field appearance specified in the data
composition schema can be used;
Only the following output parameters are allowed:
○○ Vertical placement of overalls;
○○ Field header type;
○○ Record count;
○○ Records percent.
Predefined templates are not used.
Two template types are implemented to output results to a value table or tree: the
Header Template (DataCompositionAreaTemplateValueCollectionHeader)
and the Contents Template (DataCompositionAreaTemplateValueCollection).
For this data set it is necessary to define the link from the Parent field to the
Nomenclature field with the Ref parameter. Therefore, the data set can be used to
obtain all the item parents in sequence.
The data set for hierarchy construction can either be expressly described in the
data composition schema or automatically generated by the composer of the data
composition template.
Chapter 10. Data Composition System 1-641
If the hierarchy data set is specified in the composition schema, it is necessary to
add a query of the following type:
SELECT
Nomenclature.Ref AS Ref,
Nomenclature.Parent AS Parent
{SELECT
Ref.*,
Parent}
FROM
Catalog.Nomenclature AS Nomenclature
WHERE
Nomenclature.Ref IN(&Refs)
This data set must be linked to itself, as described above. Additionally it is neces-
sary to create a link to the data set from the field, for which the hierarchy must be
built.
Create a query for the Children data set which will get the list of children:
SELECT
Children.Ref
FROM
Catalog.Children as Children
Chapter 10. Data Composition System 1-643
Additionally create a query for the Hierarchy data set which will get hierarchical
records:
SELECT
EmployeeChildren.Child AS Ref,
EmployeeChildren.ChildParent AS Parent
FROM
InformationRegister.EmployeeChildren AS EmployeeChildren
WHERE
EmployeeChildren.Child IN(&Ref)
MERGE ALL
SELECT
Employees.Ref,
NULL
FROM
Catalog.Employees AS Employees
WHERE
Employees.Ref IN(&Ref)
The first query union selects the children's parents. The second part of the query
selects employees, since the hierarchical set also has to contain hierarchical records.
Define links between the data sets.
Specify the Children data set as the link source and the Hierarchy data set as the
destination. The Ref field is the source expression and another Ref field is the
destination expression. Specify the Ref field as the link parameter and indicate that
a list of parameters is allowed.
Define the hierarchical link. Link the Hierarchy data set to itself, Parent being
the source field and Ref being the destination field. Specify the Ref field as the link
parameter and indicate that a list of parameters is allowed.
IMPORTANT!
The hierarchical data set field that the data set is linked to must have the same
name as in the source data set. Otherwise the system fails to obtain field attributes
for the hierarchical set, nor does it obtain presentation for hierarchical values.
In the report settings, create the hierarchical group by the Ref field and switch the
field’s presentation to Parent. Execute the report:
This will result in the Samuel Jones record appearing in both groups.
1-644 1C:Enterprise 8.3. Developer Guide
The Open data composition schema button opens the main data composition
schema. If no schema is available, a new one is created and assigned as the main
schema.
Chapter 10. Data Composition System 1-645
All of the above actions result in opening the template wizard that can be used to
create a template containing the data composition schema.
Clicking Finish opens the data composition schema wizard that is used to create
a data composition schema (see page 1-547) or load an existing schema from an
XML-document.
After the data composition schema is created, the report is ready for use and can
be launched in the 1C:Enterprise mode. When the report is launched, the system
auto-generates a report form and a settings form.
In addition to the main report form, the following can be selected at the Forms tab:
A report settings form that opens upon execution of the Settings command
in the 1C:Enterprise mode and is used to specify parameters for user settings
(see page 1-610).
A report variant editing form (to open it, select More – Change variant
(All actions – Change variant) in the menu of the automatic report form) that
can be used by advanced users to edit the current report variant (see page
1-599).
1-646 1C:Enterprise 8.3. Developer Guide
If the forms auto-generated by the system in the course of report use and based on
the data composition system, are not convenient for the end users, the application
developer can create custom forms. It can be done in the report form wizard.
Example:
ComposeResult(ResultCompositionMode.Directly);
If the user has no rights to view a metadata object interactively, the composi-
tion system makes all the object table fields unavailable.
Assume the following query is used as a data set:
SELECT
Doc.Ref.Date,
Doc.Ref.Number,
Doc.Nomenclature,
Balances.Balance
FROM Document.Invoice.Content AS Doc
LEFT JOIN AccumulationRegister.NomenclatureAccounting.Balance Balances
BY Doc.Nomenclature = Balances.Nomenclature
If the user has no interactive rights for the Invoice or Invoice.Content table,
the Date, Number and Nomenclature fields are unavailable. If no rights are
granted for the AccumulationRegister.NomenclatureAccounting table,
the Balance field is unavailable. If the user has no rights to any tables, none of
the fields is available.
The hierarchical data set field that the data set is linked to must have the same
name as in the source data set. Otherwise attributes fields cannot be retrieved
from the hierarchical data set.
If a dataset query in the selection list results in an expression representing
usage of the REPRESENTATION() function to the expression in another field,
the field getting the representation will not be available in settings when fields
are automatically populated.
An error will occur during data composition when grouping is executed for the
calculated field and the group requires an extension of the period.
Autoindentation is used only for the top left template cell in data composition
system group templates.
If you use a batch query in the data composition system, the fields that are
not used in the consequent batch queries are deleted from the list of selections
and grouping fields. If a query that forms a temporary table does not contain
a single field, the query is removed from the batch query. Data sets from which
no fields are used are also removed from the resulting composition template. To
prevent field removal, you need either to use the field, or to set the Required
checkbox in the field role of a data composition layout.
When data composition result is is put to a collection of values the fields of
different groups, that contain a reference to the one and the same data composi-
tion field, are put to the one column of the collection.
When MERGE or MERGE ALL is used in the data composition data set query with
automatic filling of available settings and when a filter is applied to the field
attribute, the filter is applied only in those parts of union where this attribute
exists. A filter is applied only to fields with expressions that are not equal to 0.
1-650 1C:Enterprise 8.3. Developer Guide
Chapter 11
ACCOUNTING
11.1. OVERVIEW
The Designer allows you to organize accounts among several charts of accounts and
to build a custom hierarchy of subaccounts for each chart of accounts. Accounting
totals are stored separately by the 1C:Enterprise system for each chart of accounts.
Flexible account numbering, using both numbers and letters, is permitted for the
charts of accounts.
Analytical accounting is possible for any account or subaccount, using various
analytical combinations. 1C:Enterprise system catalog items, documents or random
numbers, dates and strings may be objects of analytical accounting.
Configuration tools allow maintaining an unlimited number of accounting types
for each chart of accounts. Typical examples of account types are quantitative and
foreign currency accounting.
An accounting type is selected during the editing of the chart of accounts. The type
of accounting to be maintained can be selected for a particular account.
The Designer provides tools to set up accounting for multiple enterprises in the
same infobase. You can derive the information on the final amount for a separate
enterprise or for all enterprises collectively. This function may be useful for enter-
prises with a consolidated balance.
1-652 1C:Enterprise 8.3. Developer Guide
Secondly, when operating 1C:Enterprise, the end user can add custom accounts
and subaccounts to the charts of accounts, but he/she cannot delete the predefined
accounts and subaccounts created in the Designer.
Storing accounting totals. Accounting totals are stored in accounting regis-
ters, using the chart of accounts structure. Totals information can be viewed
in accounting register forms and can also be derived using the 1C:Enterprise script
which has methods for obtaining account turnovers and balances for any type of
accounting, both for an account or subaccount as a whole or divided into analytical
accounting objects.
two different accounts. To do so, you need to remember which subaccount of the
customers' account and which subaccount of the suppliers' account correspond to
this specific entity, then retrieve the information on the status of settlements with
this entity and process it.
When using Extra Dimensions, one Extra Dimensions list, like Organizations,
for example, is attached to all the accounts (subaccounts) for which you need to
keep analytical accounting on entities. The record of a specific entity as a supplier
is kept in the corresponding control account. If the entity also becomes a buyer,
there is no need to create a new entry in the entity list, since it has already been
entered as a vendor. 1C:Enterprise combines the information from two control
accounts for one entity automatically. In the same way, you can combine data from
any accounts recording operations that a specific entity is a part of.
Multi-level analysis. Multi-level analysis allows you to obtain accounting totals
with different levels of detail. If you use Extra Dimensions to keep analytical
accounting, then to perform a multi-level analysis, appoint a chart of characteristic
types as the Extra Dimensions types (see page 1-309). Using Charts of character-
istic types objects allows you to keep records with the necessary degree of detail.
Using the characteristic value type limits the number of nesting levels (for example,
as a value type, any hierarchical catalog can be used and using a composite type
is also allowed).
In conducting analytical accounting using subaccounts, multi-level analytical
accounting is implemented by using subaccounts of different levels.
script tools. When transaction data are entered, you can describe how transaction
attributes are to be filled with various data from the document that generates the
transaction.
In the 1C:Enterprise system, the accounting of a business transaction is always
linked to its parent document: if the document must be edited, the transaction data
are regenerated when the document is posted; if the document is deleted, the busi-
ness transaction data are deleted as well.
In general, each business transaction consists of an arbitrary number of postings.
In the 1C:Enterprise system, each accounting posting corresponds to an accounting
register record and a set of accounting register records is analogous to a business
transaction. For a description of the posting procedure see page 1-660.
The list of accounts is managed using the Actions menu commands.
The account data are formed in the account editing window (see fig. 269).
The Type attribute specifies the type of account: Active, Passive or Active/Passive.
For off-balance accounts, check the Off-balance check box. The totals for off-
balance accounts are discarded when totaling the balance.
The Order field is designed for custom accounts ordering. The length of the field
is defined in the Order length property. If the length of the field is greater than
zero, this field is used by default to order the chart of accounts. If the chart of
accounts has the Autoorder by code property set, then ordering by the Order field
Chapter 11. Accounting 1-659
The first list contains the accounting flags defined for the Chart of accounts object.
Select the check box in the Accounted column to indicate that the edited account
belongs to a certain accounting type.
For each entry in the lower list, the following parameters are defined. In the Extra
dimension type column, one of the predefined characteristic types is selected. If
this chart of accounts has subordinate objects defined in the Extra dimension
accounting flags branch, the list is appended with columns according to the
number of these objects. You should check each Extra Dimension type if analytical
accounting is required for this Extra Dimension type.
In the 1C:Enterprise mode, the end user can add custom accounts and subaccounts
in the charts of accounts, as well as edit account properties, but he/she cannot
delete accounts and subaccounts created in the Designer. In the 1C:Enterprise
mode, the following attributes only can be modified for the accounts created in the
Designer:
Account parent
Account code
Account description
Order
1-660 1C:Enterprise 8.3. Developer Guide
In operating 1C:Enterprise, the user can disable records and then re-enable them.
Disabled entries do not affect the account balance or turnovers. Records are enabled
and disabled using the Active property.
This feature is useful in accounting for planned business transaction, i.e. those that
will occur in the future. Disabling records for such a transaction, you can keep the
real totals unchanged. When these transactions take place, it is sufficient to simply
re-enable them.
When entering records, 1C:Enterprise performs various predefined operations,
making the user's work with the system faster and easier. For example, if analytical
accounting is set for a corresponding account, the system automatically opens
the list of analytical accounting objects (Extra Dimensions), so that the user can
select the required object. Many aspects of 1C:Enterprise behavior can be set up by
editing accounting register record properties.
1-662 1C:Enterprise 8.3. Developer Guide
Chapter 12
PERIODICAL CALCULATIONS
Periodical calculations are calculations made with a certain frequency; they are
closely bound one to another based on a number of rules and affect each other
within a period.
The mechanisms of periodical calculations allow you to set up their order and
correlation and organize the recording of their results.
Calculation of salary that computes accruals and withholdings is a typical example
of a periodical calculation. Calculations are usually performed on a monthly basis
and the results of one calculation can depend on the results and availability of other
calculations.
The Charts Of calculation types and Calculation registers configuration objects are
used for calculations in 1C:Enterprise. Since these objects are closely connected,
this chapter outlines the features they provide.
The subsequent sections discuss the issues of configuring the mentioned objects.
action period for record generation and this date is used by the system to assign
11/01/2008 as the action period's start date.
Registration period is the start date of the period indicated when registering the
calculation (it is defined on the basis of the recorder document date). Assume
salary for May 2008 is calculated in June 2008 (calculation periodicity: Month).
May 2008 is the action period (the date 05/01/2008 is entered in the database),
while June 2008 is the registration period (the date 06/01/2008 is entered in the
database).
Action period is the period's start date determined based on the value of the
Periodicity property. Assume the document points out that calculation
is performed for May 2008. The action period for the Periodicity property of
the Month register is defined by the date 05/01/2008; for the Quarter register –
by 04/01/2008.
Calculation action period indicates the period over which the calculation is made.
The period is defined by its beginning and end dates. Assume a sick-list record
for May 2008 has an action period of 05/01/2008; in this case the calculation
action period is defined by the beginning date (e.g., 05/06/2008) and the end date
(e.g., 05/15/2008).
Displacement mechanism or action period competition is discovering the
connections between calculation types during the calculation action period. Compe-
tition results from inability to run multiple calculations at a time. You need to select
the calculation to be performed in this period. The displacement mechanism is set
up in the description of a specific calculation type. You can adjust these settings
in the Displacing section (for calculation types). For example, Salary Payments
and Sick Leave Payments cannot be applied at the same time. This means that the
sick leave payment displaces the salary payments. In other words, when the sick
leave is active, the salary is not calculated. For a description of the displacement
mechanism see page 1-668.
Actual action period – if a calculation is not displaced by other calculations, the
actual action period is equal to the action period. If there are displacing calcula-
tion types, the actual action period is defined as a combination of non-overlapping
periods during which this calculation is not displaced. fig. 270 below shows
a graphical representation of an actual action period when the Salary calculation
is displaced by the Sick Leave calculation.
The actual action period represents secondary data, i.e. the result of system calcula-
tions. The actual action period is recalculated with the entry of any set, including
an empty one (posting undone).
IMPORTANT!
Calculation results do not depend on the data entry (registration) sequence.
Basic period defines the period where (basic) calculation results used for the
current calculation are selected. For example, when the premium pay for May
2008 is accrued, the results of the accruals performed by certain calculation types
Chapter 12. Periodical Calculations 1-665
over a certain period (e.g., Salary, Additional Pay, Vacation Pay) are taken
into account. This is the basic period for the premium pay calculation. The link
between calculation types by basic period is set up in the description of a specific
calculation type in the Base section (calculation types).
The list of predefined calculation types can be edited using the Actions menu items.
Attributes (basic and leading) of predefined calculation types depend on the proper-
ties set for this chart of calculation types object in the Calculation category.
Each predefined calculation type is edited in the modal window. The main prop-
erties of a calculation type are set in the Main tab.
If the Dependence on base calculation type property is set to Depends by action
period (Depends by registration period), the form contains the Base tab. This tab
lists the calculation types that are basic for the current calculation type and define
how the base retrieval mechanism works for a particular calculation register (see
fig. 273).
Thus, in the example below (see fig. 273), Salary and Additional pay calculation
types are basic for the Sick leave calculation type.
If the Uses action period property is set, the form contains the Displacing tab.
It lists the calculation types displacing the current calculation type over the action
period and thus defining how the displacement mechanism works for a particular
calculation register.
A displacing calculation type should be selected from the listed calculation types
(see fig. 274). In the example above, no displacing calculation types exist the Sick
leave calculation type. However, when describing the Salary calculation, select
Sick leave.
The Leading tab lists the calculation types defining how the recalculation
mechanism work for a particular calculation register (i.e., the register this list of
calculation types is assigned to).
1-668 1C:Enterprise 8.3. Developer Guide
In the 1C:Enterprise mode, the user can create custom calculation types in addi-
tion to the predefined types and set the necessary properties for them. To do so,
a form is created in the Designer in which the table boxes for basic, leading and
displaced calculation types, depending on the properties set for this list of calcula-
tion types, should be placed.
For instance, one and the same employee could have been issued a salary for
a single period multiple times.
The limitation value depends on a number of conditions (the database engine used,
computer technical parameters, etc.), but under no circumstances does this limita-
tion impact real practice.
Schedule – this property is available if the Action period property is set.
This property provides a link to the information register where a time schema for
the source data of this calculation is described. A schedule should be specified for
the calculations, depending on the source data distributed within the action period,
according to a certain rule. For example, it can be an organizational timesheet
broken down into days, a lecture schedule in hours, etc.
Schedule value – this property is available if the Action period property is set.
This property is used to select a resource of the information register defined
in the Schedule property.
For example, the OrganizationWorkSchedule information register can be
specified as a schedule. This register has the attributes WorkDay (Boolean type)
and WorkHours (Number type). The former shows whether the current date is a
workday; the latter specifies the number of work hours. Selecting WorkDay means
that the calculation analyzes whether a certain day of the period is a work day
(i.e., whether or not salary should be calculated for this day). Selecting WorkHours
means that the specified calculation is performed on the basis of the number of
working hours. The allocation itself is set in the 1C:Enterprise mode (manually or
using the 1C:Enterprise script).
Schedule date – this property is available if the Action period property is set.
This property specifies a Date-type dimension of the information register defined
in the Schedule property. Depending on the property value, binding to values of the
information register resource selected in the Schedule value property is created.
Base period – setting this property creates a mutual coherent impact of the register
records. The dependency of pay calculated by averages on the pay calculated
in the base period is a good example of coherent register records.
Periodicity defines the period in which records are registered and can affect each
other (for registers supporting an action period).
Recalculations are subordinate register objects that define the rules of register
records' mutual impact. The register's Dimension property in the Link group of
the object property palette indicates the main dimension of the current register that
is to be recalculated in case of changes of the leading register data defined in the
leading registers' Data property. For example, an individual's withholdings are
recalculated if accruals (salary, premium pay) change.
If the Base period property is set, recalculation data are created automatically.
If the property is not set the user must create the recalculation data manually
(a special form to enter recalculations and their mechanism should be developed at
the design stage).
1С:ENTERPRISE 8.3
Developer Guide
Part 2
Developer Guide
Part 2
Moscow
1C Company
2013
ENTIRE COPYRIGHT TO SOFTWARE
AND DOCUMENTATION BELONGS TO 1C Company
By purchasing 1С:Enterprise software system
you hereby agree to protect rights of 1C Company
and refrain from making copies of the software
and documentation without prior written permission from 1C Company.
PART 1
Introduction.................................................................................................................................1-21
Structure of the Guide............................................................................................................1-21
What You Need To Know......................................................................................................1-23
The Books Included in the Documentation...........................................................................1-23
Training Materials and Additional Opportunities...........................................................1-24
Text Files Included in the 1C:Enterprise 8.3 Distribution Kit.......................................1-24
About 1C:Enterprise 8 Page...................................................................................................1-24
1C:Developer Network..........................................................................................................1-24
Agreed Notation.....................................................................................................................1-25
Chapter 1. Concept of the System.............................................................................................1-27
1.1. Configurability................................................................................................................1-27
1.2. Functioning of the System..............................................................................................1-27
1.3. Basic Concepts of the System.........................................................................................1-28
1.3.1. Configuration Concept..........................................................................................1-29
1.3.2. Configuration Object............................................................................................1-30
1.3.3. Command Interface...............................................................................................1-39
1.3.4. Form......................................................................................................................1-40
1.3.5. Module..................................................................................................................1-40
1.3.6. Template...............................................................................................................1-41
1.4. Operation Modes.............................................................................................................1-42
1.4.1. File Mode .............................................................................................................1-42
1.4.2. Client/Server Mode...............................................................................................1-42
1.5. Development Tools.........................................................................................................1-43
Chapter 2. Work with Configuration.......................................................................................1-47
2.1. Opening Configuration....................................................................................................1-47
2.2. Saving Configuration......................................................................................................1-48
2.3. Closing Configuration.....................................................................................................1-48
2.4. Saving Configuration to File...........................................................................................1-49
2.5. Loading Configuration from File....................................................................................1-49
2.6. Configuration Object Tree..............................................................................................1-49
2-676 1C:Enterprise 8.3. Developer Guide
PART 2
Chapter 13. Business Processes and Tasks.............................................................................2-691
13.1. Major Concepts...........................................................................................................2-691
13.2. General Information....................................................................................................2-692
13.3. Routing........................................................................................................................2-693
13.4. Addressing System......................................................................................................2-693
13.5. Starting Business Processes........................................................................................2-696
13.6. Task Performance........................................................................................................2-697
13.7. Splitting and Joining...................................................................................................2-697
13.8. Manual Control...........................................................................................................2-698
13.8.1. Business Process Completion Attribute............................................................2-698
13.8.2. Task Performance Attribute..............................................................................2-698
13.8.3. Task Removal...................................................................................................2-699
13.8.4. Task Addition...................................................................................................2-699
13.9. Conditional Jump........................................................................................................2-699
13.10. Switch........................................................................................................................2-700
13.11. Task Generation........................................................................................................2-700
13.12. Performance Check...................................................................................................2-702
13.13. Nested Process Execution.........................................................................................2-703
13.14. Business Process Completion...................................................................................2-704
13.15. Standard Business Process and Task Attributes........................................................2-704
13.16. Business Processes with Several Starting Points......................................................2-705
13.17. Feedback....................................................................................................................2-705
13.18. Flowchart...................................................................................................................2-707
13.19. Business Process Editing...........................................................................................2-707
13.20. Task Editing..............................................................................................................2-708
Chapter 14. Data Analysis and Forecasting...........................................................................2-711
14.1. Overview.....................................................................................................................2-712
14.1.1. Main Mechanism Objects.................................................................................2-713
14.1.2. Types of Data Analysis.....................................................................................2-714
14.1.3. Forecasting Models...........................................................................................2-716
14.2. The Summary Statistics Analysis Type......................................................................2-716
14.3. The Association Rules Analysis Type........................................................................2-720
14.3.1. Rules Prune Types............................................................................................2-724
14.4. The Sequential Patterns Analysis Type.......................................................................2-725
14.5. The Decision Tree Analysis Type...............................................................................2-729
14.6. The Сlusterization Analysis Type...............................................................................2-734
14.6.1. Metrics used......................................................................................................2-739
14.6.2. Clusterization methods.....................................................................................2-741
Chapter 15. Data Exchange Mechanisms...............................................................................2-745
15.1. Goals and Objectives...................................................................................................2-745
15.1.1. Universal Data Exchange Mechanisms............................................................2-745
15.1.2. Distributed Infobases........................................................................................2-746
15.2. Universal Data Exchange Mechanisms.......................................................................2-746
15.2.1. XML Documents Read and Write Tools..........................................................2-746
15.2.2. XML Serialization............................................................................................2-746
15.2.3. Exchange Plans.................................................................................................2-759
Contents 2-683
Chapter 20. Temporary Storage Mechanism, Working with Files and Pictures................2-841
20.1. Temporary Storage......................................................................................................2-841
20.2. Working with Files and Temporary Storage...............................................................2-842
20.2.1. Saving Data from File in Temporary Storage..................................................2-842
20.2.2. Data Placement in Temporary Storage............................................................2-843
20.2.3. Data Retrieval from Temporary Storage..........................................................2-843
20.2.4. Data Deletion from Temporary Storage...........................................................2-844
20.2.5. Address Check for Temporary Storage Membership.......................................2-844
20.2.6. Attribute Address Retrieval..............................................................................2-844
20.2.7. File Retrieval from Infobase.............................................................................2-844
20.2.8. Example of File Method Use............................................................................2-846
20.2.9. Enabling Bulk File Operations.........................................................................2-847
20.2.10. Working with Temporary Storage in Background Job..................................2-849
20.2.11. Address Support in Picture Box....................................................................2-849
20.2.12. Access to standard directories.........................................................................2-851
20.3. Specific Features of Using in Web Client..................................................................2-851
Chapter 21. The Event Log......................................................................................................2-853
21.1. Details Management....................................................................................................2-853
21.2. Writing Events.............................................................................................................2-854
21.3. Event Logging Management.......................................................................................2-854
21.3.1. The Access Event Parameters Configuration...................................................2-854
21.3.2. Access Denied Event Parameters Configuration..............................................2-857
21.4. Getting Event Log Records.........................................................................................2-858
21.5. Additional Methods.....................................................................................................2-862
Chapter 22. The Cryptographic Mechanism..........................................................................2-863
22.1. General Mechanism Description.................................................................................2-863
22.2. Main Concepts.............................................................................................................2-864
22.3. General Principles of Using Cryptographic Mechanisms...........................................2-864
22.4. Working with Cryptographic Modules.......................................................................2-865
22.5. Usage Examples..........................................................................................................2-866
Chapter 23. External Data Sources.........................................................................................2-871
23.1. Working with relational external data sources............................................................2-871
23.1.1. Overview...........................................................................................................2-871
23.1.2. General Usage Principles..................................................................................2-873
23.1.3. Editing External Data Source Structure............................................................2-873
23.1.4. Example of External Data Source Table Creation ...........................................2-877
23.1.5. ODBC Connection String.................................................................................2-879
23.2. Working with an external OLAP data source.............................................................2-880
23.2.1. Overview...........................................................................................................2-880
23.2.2. The general principles of usage........................................................................2-882
23.2.3. Editing external data source structure...............................................................2-883
23.2.4. Query Language Limitations When Using
an Analytical External Data Source.................................................................2-886
23.2.5. An OLAP Server Connection String................................................................2-887
23.3. External Data Source Management.............................................................................2-888
23.4. Connecting to an External Data Source in 1С:Enterprise Mode................................2-890
23.5. Using External Data Sources.......................................................................................2-890
23.5.1. The Execution Location of External Data Source Queries...............................2-890
Contents 2-685
6.5. Specifics of System Object Behavior with Enabled Data Separation Mode...............2-1229
6.5.1. Changing Separator Values..............................................................................2-1229
6.5.2. Object Numeration............................................................................................2-1230
6.5.3. Real-Time Timestamp......................................................................................2-1230
6.5.4. Predefined Data.................................................................................................2-1230
6.5.5. Access Rights....................................................................................................2-1231
6.5.6. Users.................................................................................................................2-1231
6.5.7. Exchange Plans.................................................................................................2-1232
6.5.8. Functional Options............................................................................................2-1233
6.5.9. Scheduled Jobs..................................................................................................2-1233
6.5.10. Background Jobs.............................................................................................2-1234
6.5.11. Web Services..................................................................................................2-1235
6.5.12. Constants.........................................................................................................2-1235
6.5.13. Registers.........................................................................................................2-1235
6.5.14. Document Sequence.......................................................................................2-1238
6.5.15. Infobase Options.............................................................................................2-1239
6.5.16. Session List.....................................................................................................2-1239
6.5.17. Connection List...............................................................................................2-1239
6.5.18. The Event Log................................................................................................2-1239
6.5.19. Settings and Favorites.....................................................................................2-1243
6.5.20. History............................................................................................................2-1243
6.5.21. Queries............................................................................................................2-1244
6.5.22. Managed Transaction Locks...........................................................................2-1244
6.5.23. Exclusive mode...............................................................................................2-1244
6.5.24. Deleting Marked Objects................................................................................2-1245
6.5.25. Full-text search...............................................................................................2-1245
6.6. Running the Client Application in Linux...................................................................2-1246
6.7. Specifics of Mobile Application Operations...............................................................2-1247
Appendix 7. Operation of Various DBMS............................................................................2-1249
7.1. General Features..........................................................................................................2-1249
7.2. File Database...............................................................................................................2-1249
7.3. IBM DB2 Server.........................................................................................................2-1250
7.4. Microsoft SQL Server.................................................................................................2-1251
7.5. Oracle Database Server...............................................................................................2-1252
7.6. PostgreSQL Server......................................................................................................2-1253
Appendix 8. Work in XBase..................................................................................................2-1255
8.1. Fields and Records......................................................................................................2-1255
8.2. Spreadsheet, Spreadsheet Structure and Database File...............................................2-1255
8.3. Indices, Index and Filter Expressions and Index File.................................................2-1256
8.4. Writing Changes to Database......................................................................................2-1256
8.5. Work with Index Files.................................................................................................2-1256
8.6. Record Deletion...........................................................................................................2-1256
8.7. Creation of Database, Index and Index File................................................................2-1257
8.8. Limitations..................................................................................................................2-1257
Appendix 9. Specifics of Using Separate Mechanisms........................................................2-1259
Appendix 10. Automatic Form Element Name Generation Rules.....................................2-1261
Chapter 13
BUSINESS PROCESSES
AND TASKS
Route point reflects a stage in the life cycle of a business process, normally
involving the performance of a single automatic or manual operation.
Tasks in 1C:Enterprise allow record keeping for assignments sorted by performers
and reflect the progress of business processes to later points on the flowchart.
In addition to business processes, tasks can be created by other infobase objects or
directly by users.
Main objects – business processes and tasks – interact (e.g., a business process
creates tasks and performance of a task results in progress in the business process).
Auxiliary objects – session parameters, information registers and catalogs – do not
use each other or main objects.
When creating a business process flowchart, catalogs with predefined data (roles,
departments, etc.) are used to assign values to the route points' addressing proper-
ties. Business processes create tasks when they reach further points of the flowchart
and use Addressing (information register, see below) to process group points.
Upon completion of their performance, tasks notify business processes, thus further
advancing them. They use the information register to select tasks for the current
performer in compliance with session parameters.
Chapter 13. Business Processes and Tasks 2-693
13.3. ROUTING
The 1C:Enterprise business processes allow the use of the following routing types:
Hard. The business process has a strict flowchart, comprising no conditional
or parallel jumps, with strictly defined recipients at each route point. This type
involves no free or conditional routing.
Free. Recipients at different points of the business process flowchart are not
preset. They are determined by software or interactively during the life cycle of
the business process.
Conditional. The flowchart provides for a conditional test and progress
along the corresponding branches. Jumps can be both binary (conditional) and
multiple (switch).
Parallel. The flowchart provides for the splitting of the business process into
parallel branches with subsequent joining (wait) possible. The business process
progresses along each of the parallel branches separately as the tasks are
performed.
In real business process flowcharts, all the above routing types are normally used.
At a certain point in a business process (e.g., Accept Cash Payment), addressing
properties have only the Cashier role. When the business process reaches this point,
a single task is generated:
Task Property Value
Name Accept cash payment
Role Cashier
Employee -
When employee Jones browses his task list, the addressing system displays this
task, because the information register contains a record attributing the Cashier role
to Jones. Employee Peters cannot see this task.
Here is an approximate sequence of operations for the creation of two different
business processes.
1. Let us proceed from the assumption that the addressing system comprises three
dimensions: employee, role and department.
2. Create catalogs for each of the planned addressing dimensions (Employees,
Roles and Departments) and fill them in with predefined values, e.g.:
Employees Roles Departments
Jones Cashier Accounts Department
Peters Manager Sales Department
Smith Head of Department Warehouse
Storeroom Clerk
Chapter 13. Business Processes and Tasks 2-695
3. Create an information register and add one dimension to it per the previously
created catalog. Indicate the types for the dimensions as references to the corre-
sponding catalogs, e.g.:
Dimension Type
Employee CatalogRef.Employees
Role CatalogRef.Role
Department CatalogRef.Departments
Procedure SessionParametersSetting(RequiredParameters)
User = Catalogs.Employees.FindByDescription(UserName());
SessionParameters.CurrentPerformer = User;
EndProcedure
6. Create a task.
7. Set the previously created information register as a property of the Addressing
task.
8. Add addressing attributes similar to dimensions of the information register:
○○ Employee
○○ Role
○○ Department
9. Indicate the type of the task addressing attributes created in the form of a refer-
ence to the corresponding directory and set references to the information
register dimension in the Addressing attributes property.
Addressing Attribute Type Addressing Dimension
Employee CatalogRef.Employees Employee
Role CatalogRef.Role Role
Department CatalogRef.Departments Department
10. Select the Employee attribute as the key addressing attribute by setting it in the
corresponding task property.
11. Create the first business process with a reference to the previously created task
(the Task property) within it.
2-696 1C:Enterprise 8.3. Developer Guide
12. Create the next business process with a reference to the same task.
13. Design a flowchart for the new business process. And so on.
This example is used below to comment on the key particularities of 1C:Enterprise
business processes.
Let us discuss some of them in detail.
BP = BusinessProcesses.Match.CreateBusinessProcess();
BP.Date = CurrentDate();
BP.Write();
BP.Start();
Chapter 13. Business Processes and Tasks 2-697
A business process can be recorded without being starting. This option is useful
if you would like the business process started later than it is created. For example,
a business process can start upon occurrence of a certain event.
IMPORTANT!
Splitting does not necessarily require joining. A business process may have sev-
eral parallel branches up until its completion.
Joining is impossible without splitting. If this condition is not met, the system
displays the following message when checking the flowchart: Some lines entering
merge point do not leave branch point.
Result = True;
Else
Result = False;
EndIf;
EndProcedure
2-700 1C:Enterprise 8.3. Developer Guide
For a multiple selection, you can use several successive conditional jump points.
Switch points, however, are easier to use.
13.10. SWITCH
To select one of the available paths, switch points are used. An important feature
of these points is a switch handler, a mandatory element checked during flowchart
verification before saving the business process. If the handler is missing, the
system displays the following warning: Option selection point has no handler for
event "SwitchData processor".
This handler assigns one of preset values to the Result property. A sample handler
is shown below:
Procedure Switch (SwitchPoint, Result)
If PaymentType = Enums.PaymentType.Cash Then
Result = SwitchPoint.Cases.Cash;
ElseIf PaymentType = Enums.PaymentType.Check Then
Result = SwitchPoint.Cases.Check;
ElseIf PaymentType = Enums.PaymentType.Netting Then
Result = SwitchPoint.Cases.Netting;
ElseIf PaymentType = Enums.PaymentType.Credit Then
Result = SwitchPoint.Cases.Credit;
EndIf;
EndProcedure
Thus, for group points on flowcharts, role-based routing is used only once, when
a task list is generated.
The sequence for invocation of event handlers in the 1C:Enterprise script when
jumping to the first point of the Billing flowchart is illustrated below:
No Internal mechanism 1C:Enterprise script handlers
1 Transaction start
2 BeforeCreateTasks() handler invocation
3 Task list generation
4 OnCreateTask() handler invocation
5 Recording all the generated tasks
6 The task's BeforeWrite() handler invocation
7 Task recording
8 The task's OnWrite() handler invocation
9 Transaction completion
When a business process generates a task array, the following attributes are
assigned automatically:
Description identical to the description of the corresponding route point, e.g.
Billing;
Reference to an instance of the business process that generated the task;
Reference to a point on the business process flowchart;
Task addressing attributes identical to the addressing attributes of the corre-
sponding route point. For example, if the route point is addressed to the
Cashier role, the task's Role addressing attribute is also assigned the Cashier
value.
For a description of one of the methods to use automated task performance see
page 2-705.
Chapter 13. Business Processes and Tasks 2-703
BusinessProcess.Write();
Points = BusinessProcesses.DocumentMatch.RoutePoints;
BusinessProcess.Start(Points.SimplifiedMatch);
EndDo
EndProcedure
In other respects, business processes with several starting points are used
in precisely the same way normal business processes are used.
13.17. FEEDBACK
Other infobase objects (documents or catalog items) can be involved in business
processes and influence them.
For the business process mechanism to be effective, some tasks should be
performed automatically in response to corresponding operations with other
infobase objects (e.g., when a document is posted, a discount is granted on an
invoice, goods in stock are inventoried, etc.).
An important feature of the 1C:Enterprise business process mechanism is the
fact that it does not require a substantial modification of the applications used.
This is why response of business processes and tasks to modification of other
infobase objects is adjustable without substantially modifying the objects.
2-706 1C:Enterprise 8.3. Developer Guide
The following example illustrates the above concept. Assume a task requires
document posting. When the document is posted, the task has to be performed
automatically, so that the user does not have to open the task list, search for the task
and execute it.
To achieve this, perform the following sequence of operations:
Add a posting notification to the document form:
Procedure AfterWrite(Cancel)
If Posted Then
Notify("DocumentPosting", , ThisObject.Ref);
EndIf;
EndProcedure
WorkWithBusinessProcesses.ExecuteTaskForDocument(Source);
EndIf;
EndProcedure
...
&AtServer
// The WorkWithBusinessProcesses method of the server-side common module
Procedure ExecuteTaskForDocument(DocumentRef) Export
While Selection.Next() Do
CurrentTask = Selection.Ref.GetObject();
If CurrentTask.CheckExecution() Then
CurrentTask.ExecuteTask();
EndIf;
EndDo;
EndProcedure
Another way to have tasks performed automatically is to create and enable a noti-
fication handler that will select all tasks linked to a performer, check if they should
be performed and, if so, automatically perform them.
In the sections below, we will discuss the particularities of business process and
task object configuration.
13.18. FLOWCHART
A flowchart describes the logic of the business process and its entire life cycle,
from start to finish, in the form of a map of the passing sequence for interrelated
points in the process.
To edit a flowchart, go to the Other tab in the business process editing window
and click Route map (for details see page 2-1006).
Number length. This property defines the maximum length of a business process
number. The Designer allows this length to be set to 0 if numbers are not used
in this type of business process.
Number type. This property allows to select a value type for the business process
number, Number or String. It is similar to the document Number format property.
The string type is useful when a sophisticated numbering system is used and the
document number contains not only digits, but also letters and delimiters.
Check uniqueness. If this property is selected, when a new business process
is added, the uniqueness of its number is checked within the limits set in the
Periodicity property.
Periodicity. This property defines the scope of document number uniqueness veri-
fication and the number recycling period. If Check uniqueness is selected, then
Periodicity defines the limits of control.
If Autonumbering is selected, 1C:Enterprise assigns the next consecutive number
to each new business process. Upon completion of the cycle defined in Perio-
dicity, business process numbering restarts from 1.
The Rights tab can be used to set a privileged mode for task creation (the Privileged
mode for task creation property):
If this property is set, the system always generates tasks in the privileged mode
(at the server side and in file mode version). However, the privileged mode
is not set if tasks are generated in the client/server mode at the thick client side.
When new business processes are created, this property is set to True if the
managed application mode is selected as the main run mode in the configu-
ration properties; otherwise if the ordinary application mode is selected, the
property is set to False.
In addition to the main attributes, a set of attributes storing additional information
can be created.
If the application domain object to which the business process corresponds has both
basic properties, such as date, number, importance and check time and complex
(list) properties, such as a list of documents submitted for approval, a list of reso-
lutions or a list of business process participants, a set of tabular sections can be
created for the business process.
DATA ANALYSIS
AND FORECASTING
Data analysis and forecast is intended for implementing tools for discovering
dependencies that are usually hidden behind large amounts of data.For instance,
one can analyze sales data and identify groups of goods that are usually purchased
together. In the future (one of multiple variants) this information can be used to
merchandize goods at a retail store. Goods may be grouped together (when a buyer
comes to a store, she or he sees a barbecue and firelighters liquid, charcoal, meat,
fishing tackle and a rubber boat nearby and purchases all of it) or in different areas
of the store (a buyer comes to buy milk, and by the time he or she gets to the bread
section they will have traversed half of the store).
Another use of the data analysis mechanism is forecasting a contractor’s behavior
based on the existing data. By completing such an analysis one can find out to what
degree their purchasing volumes depend on territorial distribution, the size of the
company, period of cooperation, and other factors. Based on these dependencies,
a new contractor’s behavior may be forecast, and a strategy of cooperation developed.
Use the forecasting functionality to plan your purchasing campaign. For instance:
last month, a pet store sold 100 guinea pigs. The store must plan purchasing
volumes for the next month. One of the most widely used ways to do this is to
apply an adjustment factor to past sales periods. For instance, the adjustment factor
(demand increase factor) is 1.5. Therefore, it is reasonable to plan to purchase 150
guinea pigs for the next month. However, if we analyze what customers buy after
they buy such a pet, other conclusions can be drawn. By using data analysis and
forecasting features one can see that pet food, litter, hay, and other "accessories"
should be purchased.
It should be noted that this chapter mostly reviews 1C:Enterprise mechanisms and
only briefly mentions ways to use the information obtained through simple examples.
2-712 1C:Enterprise 8.3. Developer Guide
14.1. OVERVIEW
A general overview of the data analysis and forecasting mechanism can be
presented as follows:
This is the mechanism to be used to work with infobase data and data from other
sources, preloaded into a value table or a spreadsheet document.
Apply one of the types of analysis to the source data to obtain the analysis results.
The analysis results are a given data behavior model; it can be displayed in the
final document or stored for further use.
The analysis results can be used to create a forecast model to forecast new data
behavior, in line with the existing model.
For instance, one can analyze which goods are purchased together (on a single
invoice) and store the analysis-based forecasting model in the database. In the
future, when an invoice is created, a previously stored forecasting model can be
retrieved from the database. One can input new data from an invoice and receive
a forecast as an output, i.e. a list of goods that the next customer will probably buy
(with a certain degree of likelihood) if these goods are offered at a store.
Chapter 14. Data Analysis and Forecasting 2-713
Data analysis is an object responsible for data analysis. A data source is set
for this object, different parameters and source data are specified. This object
results in a data analysis result, while each type of analysis has its own object
for working with the analysis results.
DataAnalysisSummaryStatisticsResult
DataAnalysisAssociationRulesResult
DataAnalysisSequentialPatternsResult
DataAnalysisDecisionTreeResult
DataAnalysisClusterizationResult
Setting data analysis columns – a collection of data analysis input columns.
A data type, column role, and additional settings depending on the type of analysis
performed are specified for each column. Data analysis parameters – a set of
parameters to be used in data analysis. The range of parameters depends on the
selected type of analysis. For instance, the number of clusters to divide source
objects into, a measurement of distance between objects, etc. should be specified
for cluster analysis.
Data source – source data for the analysis. A query result, spreadsheet document
cell area, or a value table may function as a data source.
2-714 1C:Enterprise 8.3. Developer Guide
Data analysis result – a special object that contains information on the result of
analysis. Each type of analysis provides its own result. For instance, Decision tree
data analysis result will be an object of type DataAnalysisDecisionTreeResult.
In the future, the result may be output to a spreadsheet document with the help of
the data analysis result builder. It can be output through a programmatic access
to its content, and can also be used to create a forecast model. Any data analysis
result may be stored for further use.
Forecast model – is a special object to execute forecasting on the basis of input
data (a forecast selection, selection columns settings, result settings, and analysis
result). The type of the forecast model depends on the type of data analysis result.
For instance, a model created for Association rules, will have type Predic-
tionModelAssociationRules. This model will output forecasts of the following
type: since this customer has purchased a specified set of goods, he or she will buy
another set of goods with a certain probability. The forecasting data source is an
input to the forecasting model. The result is a value table that contains forecast
values.
Input column setup – is a set of special objects that show correspondence between
forecasting model columns and forecast selection columns. For instance, a forecast
model column named Goods may match a Nomenclature selection column.
Result columns setup – controls which columns will be included in the resulting
forecast model table. For instance, a nomenclature item that the customer will
probably buy and the probability of purchase can be output as an association rules
result.
Result columns – is a table of results that includes columns specified in output
column settings and contains forecast data. The specific content depends on the
type of analysis.
Accumulated frequency is the total of the value frequency and the total of
frequencies of previous data selection values.
Accumulated relative frequency is the total of the accumulated value frequency
and the total of relative frequencies of previous values.
Contiguous data:
Number of values.
Minimum value.
Maximum value.
Average.
Range is the difference between the maximum and the minimum values.
Standard deviation (root-mean-square deviation).
Median is a value in the middle of the selection.
It should be noted that if several fields of different types are analyzed simultane-
ously, they are analyzed independently (without any mutual correlation).
Let us review the characteristics mentioned in the example.
Data selection (source of analysis) looks as follows:
Nomenclature item Quantity Nomenclature item Quantity
Folding dining table 1 Folding dinner table 1
Round stool 2 Square stool 3
"Coziness" sofa 1 "COMFORT" armchair 2
"Jeans" sofa 1 "COMFORT" armchair 2
"Jeans" armchair 2 "Wardrobe" closet 1
Kitchen table 0.9x1.7 1 Folding dinner table 1
"COMFORT" sofa 1 Square stool 2
Kitchen table 0.9x1.7 1 Dining table 1
"Summer" chair 4 "Summer" chair 2
"COMFORT" sofa 1 Round stool 2
The following characteristics will be calculated, based on data analysis for the
Count field (Contiguous analysis data type):
Characteristic Value
Values 20
Minimum 1
Maximum 4
Average 1.6
Range 3
Standard deviation 0.8208
Median 1
2-718 1C:Enterprise 8.3. Developer Guide
To perform this analysis, use a code fragment similar to the one below:
&OnClient
Procedure Summary Statistics(Command)
Result = AnalysisSummaryStatistics();
EndProcedure
&OnServerWithoutContext
Function AnalysisSummaryStatistics();
Analysis = New DataAnalysis;
Analysis.AnalysisType = Type("DataAnalysisSummaryStatistics");
Analysis.DataSource = Query.Execute();
AnalysisResult = Analysis.Execute();
Data analysis operations are performed in a server’s out-of-context function that
returns a spreadsheet document containing the analysis results to the client. First of
all, the DataAnalysis object is created. Next, the type of analysis to be completed
is selected.
A query is then defined based on the text. The query result is set as the source of
the analysis data. The analysis itself is completed when the Execute() method
of the DataAnalysis object is executed. The analysis itself has no tools for
visualizing analysis results. The DataAnalysisReportBuilder object is used
for this purpose. When this object is created, the type of analysis to be conducted
is re-specified. Then, the result of the received analysis is transferred as the first
parameter of the Put() method, and the SpreadsheetDocument object created
earlier is transferred as the second parameter.
At the conclusion of the algorithm, the spreadsheet document containing the
analysis result is returned to the client’s Result data processor attribute with type
SpreadsheetDocument.
As a result, data similar to that analyzed above will be obtained.
2-720 1C:Enterprise 8.3. Developer Guide
A query result, spreadsheet document cell area, or a value table may function as
a data source. From the point of view of this type of analysis, source columns may
be divided as follows:
NotUsed – ignored by the analysis.
Object – data from this column is used as objects (or events) of the executed
analysis. Based on the values of this column, values of another column (Item)
refer to one associated group.
Item – data from this column is used to obtain stable groups of values and
create association rules.
Chapter 14. Data Analysis and Forecasting 2-721
The following analysis parameters impact the analysis result, together with column
types settings:
MinSupport – determines the minimum percentage of cases when a certain
combination of elements should occur. The groups where this value is less
than the specified value are not included into the analysis result.
MinConfidence – shows the minimum percentage of cases when the rule
is followed.
MinImportance – groups with a value less than the specified value are not
included into the analysis result.
PruneRulesType – one of the variants of the AssociationRulesPruneType
system enumeration:
○○ Redundant – redundant rules are pruned.
○○ Covered – the rules covered by other rules are pruned.
The result of analysis is as follows:
Information on the data (number of objects, number of items, average number of
items in an object, number of groups found, number of association rules found).
Groups of items found – the contents of the group, the number of cases, and the
percentage of cases where this group occurs is specified.
Association rules detected – a source set of elements, consequent (structure
of elements), percentage of cases, confidence, and importance of the rule are
specified.
Let us review the peculiarities of this type of analysis with the following data selec-
tion (we will try to determine a standard set of goods usually purchased together):
Recorder Nomenclature
Sales invoice No. 000000001 Folding dining table
Round stool
Sales invoice No. 000000002 COMFORT sofa
Sales invoice No. 000000003 Jeans sofa
Jeans armchair
Sales invoice No. 000000005 Kitchen table 0.9x1.7
COMFORT sofa
Sales invoice No. 000000004 Kitchen table 0.9x1.7
"Summer" chair
COMFORT sofa
Sales invoice No. 000000006 Folding dinner table
Square stool
Sales invoice No. 000000007 COMFORT armchair
Sales invoice No. 000000008 COMFORT armchair
Sales invoice No. 000000009 Wardrobe closet
Sales invoice No. 000000010 Folding dining table
Square stool
Dinner table
Sales invoice No. 000000011 "Summer" chair
Round stool
2-722 1C:Enterprise 8.3. Developer Guide
An attribute through which data is related to one group is called the recorder value
(a nomenclature specified in one document is considered to be simultaneously
purchased). That means that the Recorder will be an object of analysis, and the
Nomenclature will be an item of analysis.
The following code fragment will be used for analysis:
&OnClient
Procedure AssociationRules(Command)
Result = AnalysisAssociationRules();
EndProcedure
&OnServerWithoutContext
Function AnalysisAssociationRules();
Analysis = New DataAnalysis;
Analysis.AnalysisType = Type("DataAnalysisAssociationRules");
Analysis.DataSource = Query.Execute();
AnalysisResult = Analysis.Execute();
Return Spreadsheet;
EndFunction
Chapter 14. Data Analysis and Forecasting 2-723
The selection uses data from 11 documents (a reference in the Recorder field), the
number of different nomenclature items is twelve:
Nomenclature
Folding dining table
Round stool
"Coziness" sofa
Jeans sofa
Jeans armchair
Kitchen table 0.9x1.7
"COMFORT" sofa
"Summer" chair
Square stool
"COMFORT" armchair
Wardrobe closet
Dining table
The whole group occurs in the document in only two cases out of eleven (which
is shown in columns Number of cases and Percentage of cases).
The following association rules have been received:
Let us review the second one. Position Square stool occurred together with position
Folding dining table in two cases out of eleven in this document. Based on this, the
support has been calculated: (2/11*100 = 18.18%).
Confidence has been calculated as follows: both nomenclature items have been
purchased in two cases, while position Folding dining table occurred 3 times. Based
on this, confidence is equal to 2/3*100 = 66.67%.
Importance is evaluated as a ratio between the rule’s confidence and the support
of Square stool position in the goods purchased. This position occurs in two
documents out of eleven (18.18%). Importance is equal to 66.67%/18.18% = 3.67.
The following analysis parameters impact the result of the analysis together with
column type settings:
MinSupport – the minimum percentage of sequences where the sequence
template is observed.
MinInterval – an attribute used to set the minimum sequence interval (an
interval measurement unit, i.e. repetition, shall be defined).
MaxInterval – an attribute used to set the maximum sequence interval (an
interval measurement unit, i.e. repetition, shall be defined).
TimeSliceWindow – an attribute setting the time slice window (a time slice
window measurement unit, i.e. its repetition, shall be defined).
MinLength – the minimum length of sequences searched.
FindInHierarchy – a flag of hierarchy search (covers columns of the Item
type).
Chapter 14. Data Analysis and Forecasting 2-727
The sequence templates found are the main result of the analysis. These templates
contain the following information:
contents of a sequence template
number of cases when this sequence has been observed
maximum intervals between events (if there are only 2 events, there is one
interval)
minimum intervals between events (if there are only 2 events, there is one
interval)
percentage of cases when the sequence has been executed
average intervals between events (if there are only 2 events, there is one
interval)
Let us review how this type of analysis is executed using the following data selec-
tion:
Contractor First purchase Second purchase Third purchase Interval
V.I. Bondarev Folding dining table COMFORT sofa COMFORT 25 days, 31 days
Round stool armchair
I.P. Ivanov Jeans sofa
Jeans armchair
B.S. Petrov Kitchen table 0.9x1.7 COMFORT 43 days
"Summer" chair armchair
COMFORT sofa
G.O. Sidorov Folding dining table
Square stool
V.K. Stepanov Folding dining table
Square stool
Dining table
D.E. Fedorov Kitchen table 0.9x1.7 Wardrobe closet "Summer" chair 58 days, 29 days
Comfort sofa Round stool
2-728 1C:Enterprise 8.3. Developer Guide
Data from the Contractor column will define affiliation to a certain chain of
events, i.e. they define the sequence of analysis. The Nomenclature is an element
of the sequence received.
To perform this analysis, use a code fragment similar to the one below:
&OnClient
Procedure SequentialPatterns(Command)
Result = AnalysisSequentialPatterns();
EndProcedure
&OnServerWithoutContext
Function AnalysisSequentialPatterns();
Analysis = New DataAnalysis;
Analysis.AnalysisType = Type("DataAnalysisSequentialPatterns");
Analysis.DataSource = Query.Execute();
Analysis.ColumnsSetting.Period.ColumnType = DataAnalysisColumnTypeSequentialPatterns.Time;
AnalysisResult = Analysis.Execute();
The Period field is defined as Time directly from the code (it is not analytically).
Analysis parameters set by default:
The number of elements is 12. This is also the number of nomenclature positions
that occur in the data selection.
Two sequences have been found:
The first sequence occurs in two cases out of five. Therefore, support is 40%.
Since the sequence depth is 2, each of these intervals contains one value.
Let us review how this type of analysis is executed with the following data selec-
tion:
Number Number Company Agreement Type Status
Contractor
of retail spots of cars age date of agreement of relations
ZAO Igor 1 0 Less than Less than Dealer Infringement
a year a year of contract
ZAO TorgMebel 15 4 From three Less than Distributor Terminated
to ten a year by contractor
years
ZAO TorgMebel 1 10 From three From one to Distributor Terminated
to ten three years by contractor
years
ICP Dubrava 1 1 From one Less than Dealer Terminated
to three a year by contractor
years
Store 15 1 1 Over 10 From three to L o n g - t e r m Not termi-
years ten years partner nated
OOO Gross 3 2 Less than Less than L o n g - t e r m Not termi-
a year a year partner nated
Chapter 14. Data Analysis and Forecasting 2-731
To perform this analysis, use a code fragment similar to the one below:
&OnClient
Procedure DecisionTree (Command)
Result = AnalysisDecisionTree();
EndProcedure
&OnServerWithoutContext
Function AnalysisDecisionTree();
Analysis = New DataAnalysis;
Analysis.AnalysisType = Type("DataAnalysisDecisionTree");
Query.SetParameter("Parent", Group);
Analysis.DataSource = Query.Execute();
Analysis.Parameters.SimplificationType.Value = DecisionTreeSimplificationType.DontSiplify;
AnalysisResult = Analysis.Execute();
Classification errors appear when the received rules do not match the reality (source
data selection):
Based on the data specified, there are no errors in the received classification, i.e.
data in the actual selection matches classification data.
An example above is based on the DontSimplify value of the Simplification-
Type analysis parameter. This parameter value is set programmatically in the
example above. If a Simplify value is set for the parameter, the decision tree will
look as follows:
Tree simplification means that tree nodes are turned into leaves (redundant
branching is pruned) using specific rules (or formulas, see below).
The following should be taken into consideration in deciding whether a node
should be turned into a leaf:
Errors – number of errors in a node
ChildErrors – number of errors in child nodes
Leaves – number of leaves in a node
Cases – number of cases
2-734 1C:Enterprise 8.3. Developer Guide
In this example, the condition is satisfied for nodes Company age (0.5 < 1).
For instance, in one case the real sample contained the value Terminated
by contractor, while according to classification it should have been Not
terminated, etc.
A data source is provided as input to the DataAnalysis object. A query result,
spreadsheet document, cell area, or a value table may function as a data source.
Source columns are defined as input or not used. It should be noted that all column
values are included in DataAnalysisColumnTypeClusterization system
enumeration. This enumeration includes further values (both not used and input),
but these other values are used to build forecasts.
2-736 1C:Enterprise 8.3. Developer Guide
Analysis is performed in accordance with the analysis parameters set.
Let us use the following code fragment as an example to illustrate how cluster
analysis can be performed:
&OnClient
Procedure ClusterAnalysis (Command)
Result = AnalysisClusterization();
EndProcedure
&OnServerWithoutContext
Function AnalysisClusterization();
Analysis = New DataAnalysis;
Analysis.AnalysisType = Type("DataAnalysisClusterization");
Query.SetParameter("Parent", Group);
Analysis.DataSource = Query.Execute();
// Metrics selection.
Analysis.Parameters.DistanceMetric.Value =
DataAnalysisDistanceMetricType.SquaredEuclidean;
AnalysisResult = Analysis.Execute();
Return Spreadsheet;
EndFunction
Chapter 14. Data Analysis and Forecasting 2-737
A query is processed for catalog Contractors. According to the conditions of the
query, only detailed catalog entries from the Legal entities group are selected.
Executing this code will define the following values as initial analysis settings
(some of them are set explicitly, others are set by default).
The content of these columns has been defined on the basis of the query selection
fields. By default, they are defined with an equal weighting. The Contiguous data
type has been defined for the Number and Date types, with the Discrete data type
for all other types. If column parameters need to be changed, this can be done as
follows:
Analysis.ColumnsSetting.VehicleCount.AdditionalParameters.Weight = 2;
Weighting has been increased for column VehicleCount in this string.
The data selection which will be analyzed is as follows:
Number Number Company Agreement Type Status
Contractor
of retail spots of cars age date of agreement of relations
ZAO Igor 1 0 Less than Less than Dealer Infringement
a year a year of contract
ZAO TorgMebel 15 4 From three Less than Distributor Terminated
to ten a year by contractor
years
ZAO TorgMebel 1 10 From three From one to Distributor Terminated
to ten three years by contractor
years
ICP Dubrava 1 1 From one Less than Dealer Terminated
to three a year by contractor
years
Store 15 1 1 Over 10 From three to L o n g - t e r m Not termi-
years ten years partner nated
OOO Gross 3 2 Less than Less than L o n g - t e r m Not termi-
a year a year partner nated
2-738 1C:Enterprise 8.3. Developer Guide
Note that the analysis outputs data concerning the clusters found (their number,
centers, and the distance between them). No data about which objects (in our
case, contractors) are members of what clusters is obtained from the analysis.
Chapter 14. Data Analysis and Forecasting 2-739
This behavior can be observed if the analysis parameters are not set explicitly (the
TableFillType parameter, in particular).
To see the object distribution among the clusters as a result of the analysis, define
the following code string before the analysis (but after defining its type):
Analysis.Parameters.TableFillType.Value = DataAnalysisResultTableFillType.UsedFields;
14.6.1.1. Euclidean
This metric calculates the distance between two objects using the following
formula:
Where:
Xi, Yi – attribute values of two objects (the distance between which we need to
determine)
Wi – weighting factor of an attribute (set in the analysis column)
i – attribute number, from 1 to n
n – number of attributes
For instance, objects are characterized by a property that is 9 for one object and 5
for another one. The weighting factor of this attribute is 1. The distance between
the objects is as follows:
Where:
Xi, Yi – attribute values of two objects (the distance between which we need to
determine)
2-740 1C:Enterprise 8.3. Developer Guide
Where:
Xi, Yi – attribute values of two objects (the distance between which we need to
determine);
Wi – weighting factor of an attribute (set in the analysis column);
i – attribute number, from 1 to n;
n – number of attributes.
For instance, objects are characterized by two attributes that have values of 3 and 5,
7 and 3. The weighting factor of the first one is 2, of the second – 1:
14.6.1.4. Maximum
This metric calculates the distance between two objects using the following
formula:
Where:
Xi, Yi – attribute values of two objects (the distance between which we need to
determine)
Wi – weighting factor of an attribute (set in the analysis column)
i – attribute number, from 1 to n
n – number of attributes
For instance, objects are characterized by two attributes that have values of 3 and 5,
7 and 3. The weighting factor of the first one is 2, of the second – 1 (see fig. 300):
14.6.2.3. Centroid
A clusterization method that connects an object to the group with a minimum
distance to the centroid.
The example shown in the picture adds object 7 to a group that contains objects 4,
5, and 6. The distance to the centroid (an imaginary object with average attribute
values) is minimal.
14.6.2.4. K-means
This method selects the objects that come first in the selection. They are considered
to be centers of clusters. Then, the following object is selected, and is affiliated to
one or another cluster based on its distance to the centers of clusters. The center of
the cluster to which an object has been added is recalculated.
Chapter 14. Data Analysis and Forecasting 2-743
The procedure continues until all objects have been analyzed. New selection
of objects is made afterwards (starting from the first one). The procedure
is repeated until cluster centers change.
For instance, objects 1 and 2 have been arbitrarily selected as cluster centers. Object
3 is added to the cluster with a center in object 1. The center of the first cluster
is recalculated (it is between object 1 and 3). Object 4 is added to the second
cluster (its center is also recalculated).
After all objects under analysis have been processed, objects 1 and 3 relate to
cluster 1, while the second cluster includes all other objects (with a center suppos-
edly in the center of a triangle formed by objects 4, 7, and 6).
Then objects are selected and distributed between the clusters again (cluster centers
are constantly recalculated).
In the third selection of objects, object 2, which was initially the center of the
second cluster will probably relate to the first cluster.
At the end of algorithm execution, cluster 1 will include objects 1, 2, and 3.
The second cluster will include objects 4, 5, 6, and 7.
2-744 1C:Enterprise 8.3. Developer Guide
DATA EXCHANGE
MECHANISMS
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:v8="http://v8.1c.ru/data"
Date
Boolean
BinaryData
NULL
UUID
ValueStorage
All references to database objects
References to enumerations, defined in metadata
Number
Description:
The XML decimal data type from the http://www.w3.org/2001/XMLSchema
namespace corresponds to the Number type.
Rules for representing values of this type are defined in the "XML Schema
Part 2: Datatypes" document.
Example:
<!-- No explicit setting of root item name -->
<decimal>45684.087</decimal>
<!-- Explicit setting of XML root item name -->
<Amount>523</Amount>
<!-- Explicit setting of XML data type-->
<Data xsi:type="xsd:decimal">64793.01</Data>
String
Description:
The string data type from the http://www.w3.org/2001/XMLSchema namespace
corresponds to the String type. String is recorded in XML as is.
Example:
<!-- No explicit setting of root item name -->
<string>This is a string</string>
<!-- Explicit setting of XML root item name -->
<Name>Jones</Name>
<!-- Explicit setting of XML data type-->
<Data xsi:type="xsd:string">This is a string</Data>
Date
Description:
Date-type values are represented as YYYY-MM-DDTHH:MM:SS, where:
YYYY is the year in four digits;
MM is the month in two digits;
Chapter 15. Data Exchange Mechanisms 2-749
Boolean
Description:
The boolean data type from the http://www.w3.org/2001/XMLSchema name-
space corresponds to the Boolean type.
The False value is represented by the false string and the True value
is represented by the true string. This format is provided in the "XML
Schema Part 2: Datatypes" document.
Example:
<!-- No explicit setting of root item name -->
<boolean>false</boolean>
<!-- Explicit setting of XML root item name -->
<Posted>true</Posted>
<!-- Explicit setting of XML data type-->
<Data xsi:type="xsd:boolean">true</Data>
BinaryData
Description:
The XML base64Binary data type from the http://www.w3.org/2001/XMLS-
chema namespace corresponds to the BinaryData type.
Values of this type are represented as binary data, encoded using the Base64
algorithm, described in RFC 2045 (http://www.faqs.org/rfcs/rfc2045.html).
Example:
<!-- No explicit setting of root item name -->
<base64Binary>YWJjZGVm</base64Binary>
<!-- Explicit setting of XML root item name -->
2-750 1C:Enterprise 8.3. Developer Guide
<BinaryData>YWJjZGVm</BinaryData>
<!-- Explicit setting of XML data type-->
<Data xsi:type="xsd:base64Binary">YWJjZGVm</Data>
NULL
Description:
The XML Null data type from the http://v8.1c.ru/data namespace corresponds
to the NULL type. This type has a single value, represented by an empty string.
Example:
<!-- No explicit setting of root item name -->
<v8:Null/>
<!-- Explicit setting of XML root item name -->
<Selected/>
<!-- Explicit setting of XML data type-->
<Data xsi:type="v8:Null"/>
UUID
Description:
The XML UUID data type from the http://v8.1c.ru/data namespace corresponds
to the UUID type.
Values of this type are represented in XML according to generally accepted
practice and standards (ISO-11578, DCE 1.1: Remote Procedure Call –
Universal Unique Identifier).
Example:
<!-- No explicit setting of root item name -->
<v8:UUID>3294be0f-c039-41a9-bd65-596da0dcfe68</v8:UUID>
<!-- Explicit setting of XML root item name -->
<Id>da035e32-3f7a-4d87-accf7db8cb4b</Id>
<!-- Explicit setting of XML data type ->
<Data xsi:type="v8:UUID">08839b0b-5ec3-4a53-a9f5-173312316919</Data>
ValueStorage
Description:
The XML ValueStorage data type from the http://v8.1c.ru/data namespace
corresponds to the ValueStorage type.
Values of this type are represented in XML as ValueStorage, saved to file
and then encoded using the Base64 algorithm.
Example:
<!-- No explicit setting of root item name -->
<v8:ValueStorage>AQEOAAAAAAAAAO+7v3siUyIsIjHQoSJ9</v8:ValueStorage>
<!-- Explicit setting of XML root item name -->
Chapter 15. Data Exchange Mechanisms 2-751
<Data>AQEOAAAAAAAAAO+7v3siUyIsIjHQoSJ9</Data>
<!-- Explicit setting of XML data type-->
<Data xsi:type="v8:ValueStorage">AQEOAAAAAAAAAO+7v3siUyIsIjHQoSJ9</Data>
Type
Description:
The XML Type data type from the http://v8.1c.ru/data namespace corresponds
to the Type type. The XML item representing a value of this type contains text
providing the name of the XML type corresponding to the 1C:Enterprise data
type.
At first glance, Type appears to be a simple data type rather than complex,
since the item representing the value of this type does not contain nested items.
However, this is not the case. There really are no nested items. However, the
item text containing the name of the XML data type, contains the prefix for
the type namespace which must be defined in this item or in one of the parent
items, making the item text not entirely self-sufficient. Therefore, this type
is not considered simple.
Example:
<!-- No explicit setting of root item name -->
<v8:Type>v8:ValueStorage</v8:Type>
<!-- Explicit setting of XML root item name -->
<Tp>xsd:string</Tp>
<!-- Explicit setting of XML data type-->
<Data xsi:type="v8:Type">v8:ValueStorage<Data>
TypeDescription
Description:
The XML TypeDescription data type from the http://v8.1c.ru/data namespace
corresponds to the TypeDescription type. The root item representing the
TypeDescription type value, includes a set of nested items, each containing
a component of the type description.
The nested Types item from the http://v8.1c.ru/data namespace represents
separate types entered into the type description. The NumberQualifiers item
Chapter 15. Data Exchange Mechanisms 2-753
ConstantValueManager.<Constant name>
Description:
Each of the ConstantValueManager.<Constant name> types has a corre-
sponding XML data type (ConstantValueManager.<Constant name>), not
associated with any namespace.
Example:
<ConstantValueManager.OrganizationName>
<Value>Mobius LLC</Value>
</ConstantValueManager.OrganizationName>
Database Objects
Description:
Database objects are represented in XML as a combination of attribute
values and tabular sections. The name of the XML data type corresponding
to the database object is defined as the name of the 1C:Enterprise value type
in English. XML data types for database objects are not associated with any
namespace. The list of XML items nested in the root item is defined by the
type of object as well as the list of attributes and tabular sections.
2-754 1C:Enterprise 8.3. Developer Guide
<DocumentFrequency>1</DocumentFrequency>
<SettlementFrequency>1</SettlementFrequency>
<Goods>
<Row>
<Nomenclature>
297c6534-5a08-11d7-9324-0050ba8480bd</Nomenclature>
<UnitOfMeasure>
297c6535-5a08-11d7-9324-0050ba8480bd
</UnitOfMeasure>
<Price>4537.56</Price>
<Sum>13612.68</Sum>
<VATRate>VAT20</VATRate>
<VATSum>2722.54</VATSum>
<ITRate>1ac73736-5a08-11d7-9324-0050ba8480bd</ITRate>
<ITSum>0</ITSum>
<NomenclatureCharacteristic>
00000000-0000-0000-0000-000000000000
</NomenclatureCharacteristic>
<Placement xsi:nil="true"/>
<Factor>1</Factor>
<Count>3</Count>
<DiscountExtraChargePercent>0</DiscountExtraChargePercent>
</Row>
<Row>
<Nomenclature>
317f12d8-5a08-11d7-9324-0050ba8480bd</Nomenclature>
<UnitOfMeasure>
317f12d9-5a08-11d7-9324-0050ba8480bd
</UnitOfMeasure>
<Price>4915.55</Price>
<Sum>19662.2</Sum>
<VATRate>VAT20</VATRate>
<VATSum>3932.44</VATSum>
<ITRate>1ac73736-5a08-11d7-9324-0050ba8480bd</ITRate>
<ITSum>0</ITSum>
<NomenclatureCharacteristic>
00000000-0000-0000-0000-000000000000
</NomenclatureCharacteristic>
<Placement xsi:nil="true"/>
<Factor>1</Factor>
<Count>4</Count>
<DiscountExtraChargePercent>0</DiscountExtraChargePercent>
</Row>
</Goods>
<Returnables/>
</DocumentObject.CustomerOrder>
NOTE
This example and others given in this chapter use long strings (e.g.,
<UnitOfMeasure>317f12d9-5a08-11d7-9324-0050ba8480bd</UnitOfMeasure>). Due
to book format limitations, these strings are wrapped to the next line(s). In prac-
tice, these strings are each written on a single line.
2-756 1C:Enterprise 8.3. Developer Guide
Record Set
Description:
The XML representation of a record set includes the filter used to retrieve the
record set and the records. Filter values represented in the nested XML item
named Filter are not associated with any namespace. All records comprising
a set of records are represented in the nested Records item that is also not
associated with any namespace. Records are represented by Record XML items
nested in the Records item. The name of the Record item is also not associ-
ated with any namespace.
Example:
Below is an XML representation for a record set of the CompanyProductIn-
ventory accumulation register:
<AccumulationRegisterRecordSet.CompanyProductInventory>
<Filter>
<Recorder xsi:type="DocumentRef.Goodsales">
1725f36e-6f35-11d7-932d-0050ba8480bd</Recorder>
</Filter>
<Records>
<Record>
<Recorder xsi:type="DocumentRef.Goodsales">
1725f36e-6f35-11d7-932d-0050ba8480bd</Recorder>
<Period>2008-04-13T17:45:39</Period>
<MovementType>Expense</MovementType>
<Active>true</Active>
<Nomenclature>
297c6556-5a08-11d7-9324-0050ba8480bd</Nomenclature>
<CompanyWarehouse>
317f1317-5a08-11d7-9324-0050ba8480bd</CompanyWarehouse>
<Order xsi:nil="true"/>
<RetailPrice>0</RetailPrice>
<NomenclatureCharacteristic>
00000000-0000-0000-0000-000000000000
</NomenclatureCharacteristic>
<Count>2</Count>
<CompanySubdivision>
317f130d-5a08-11d7-9324-0050ba8480bd
</CompanySubdivision>
</Record>
<Record>
<Recorder xsi:type="DocumentRef.Goodsales">
1725f36e-6f35-11d7-932d-0050ba8480bd</Recorder>
<Period>2008-04-13T17:45:39</Period>
<MovementType>Expense</MovementType>
<Active>true</Active>
<Nomenclature>
297c6558-5a08-11d7-9324-0050ba8480bd</Nomenclature>
<CompanyWarehouse>
Chapter 15. Data Exchange Mechanisms 2-757
317f1317-5a08-11d7-9324-0050ba8480bd</CompanyWarehouse>
<Order xsi:nil="true"/>
<RetailPrice>0</RetailPrice>
<NomenclatureCharacteristic>
ac47d77e-5ec7-11d7-9329-0050ba8480bd
</NomenclatureCharacteristic>
<Count>2</Count>
<CompanySubdivision>
317f130d-5a08-11d7-9324-0050ba8480bd
</CompanySubdivision>
</Record>
</Records>
</AccumulationRegisterRecordSet.CompanyProductInventory>
ObjectDeletion
Description:
The XML ObjectDeletion data type from the http://v8.1c.ru/data namespace
corresponds to the ObjectDeletion type. The root item of the XML-repre-
sentation for the ObjectDeletion type value contains a nested Ref item from
the http://v8.1c.ru/data namespace which contains a presentation of a database
object reference.
Example:
Below is an example of XML representation of an ObjectDeletion object:
<v8:ObjectDeletion xmlns="http://v8.1c.ru/data">
<v8:Ref xsi:type="CatalogRef.Banks">
60c5cec3-7f6f-4ec3-9620-e757fe3614ca</v8:Ref>
</v8:ObjectDeletion>
If the corresponding XML data type is defined, then the method returns the
XMLDataType value. If there is no corresponding XML data type, then the method
returns the Undefined value.
The FromXMLType() method has two call variants. In the first variant, the method
has a single XMLDataType parameter. The second option has two parameters:
the XML type name and the namespace. In both cases, this method returns the
1C:Enterprise data type to the corresponding XML data type, if available; other-
wise it returns the Undefined value.
Two global methods can be used to read and write various values to and from
XML: WriteXML() and ReadXML().
The WriteXML() method has two required parameters. The first parameter is the
XMLWriter type object used to write XML, while the second is the value which
needs to be written in XML. Optional parameters make up three different variants
for calling this method.
In the simplest case, there are three parameters and the third parameter specifies the
XMLTypeAssignment enumeration value and creates the need to specify the XML
data type explicitly in the xsi:type attribute of the XML root item.
The next variant uses a string value as the third parameter, indicating the name of
the XML root item. This implies that the namespace is not defined. The fourth
parameter is a XMLTypeAssignment value that requires explicit setting of the
XML data type.
Finally, the last variant includes, after the parameter for the XML root item name,
an additional parameter – a string value indicating the namespace associated with
the root item. The last parameter still has the XMLTypeAssignment type.
...
Val = "A string";
WriteXML(Wr, Val);
WriteXML(Wr, Val, "Root", XMLTypeAssignment.Explicit);
WriteXML(Wr, Val, "Root", "urn:some-namespace");
...
read. A value type that needs to be read from XML can be specified as the second
parameter. If the value type is explicitly assigned in XML, then Undefined can
be used as the second parameter or it can be omitted altogether. In this case the
ReadXML() method attempts to define the type of value being read based on the
xsi:type attribute or, if the xsi:type attribute is missing, based on the item name.
If you cannot successfully establish the type or the value of the specified type
cannot be read from XML, an exception is raised. Upon successful completion the
ReadXML() method returns the value it has read.
Please note how constant value managers, database objects and record sets are read.
A successful reading using the ReadXML() method returns the value read from
XML, but this value has not yet been recorded in the database. If, for example,
a catalog item has been read, then in order to record the it in the database the
Write() method has to be used, just like when "standard" modified objects are
recorded. It also applies to other database objects, constant record managers and
record sets.
When reading a database object from XML, objects with the same reference value
are searched for. If such an object is found, its reading from XML looks like it has
been read from the database; then the values of its attributes, tabular sections, etc.
are replaced with values received from XML. If the object is not found by refer-
ence, reading from XML looks like creating a new object, specifying reference
values and filling it with values read from XML.
The CanReadXML() method defines whether it is possible to read a value from
the XMLReader object located in the current position of the XML document.
The XMLReader object is passed to this method as a parameter. If the method
returns True, reading is possible; if False is returned, the value cannot be read.
The GetXMLType() method can be used to retrieve the XML data type corre-
sponding to the current XML document position from the XMLReader object.
This method also has one parameter – XMLReader.
Exchange plan data items are called exchange plan nodes. This is similar to
a catalog structure where catalog data items are catalog items. Each exchange plan
node designates a data transfer participant for a particular exchange plan. One of
the nodes corresponds to the infobase and the rest correspond to other participants
with which this infobase can exchange.
Data are transferred between nodes through messages. The tools for working with
messages constitute the message infrastructure. Each message is associated with
a specific exchange plan and has a defined sender node and recipient node. A
message cannot be sent to or received from an unknown node. Each message has its
own (integer) number.
Change registration service is used to register data changes effected by
1C:Enterprise in order to provide the opportunity of transferring just the changes
and not all the data during data exchange.
Therefore, exchange plans define the set of tools used to organize data exchange.
We will review these tools in more detail.
Suppose it is necessary to organize data exchange between two infobases using
the RemoteWarehouses exchange plan. One of these infobases carries out the
functions of a central office and the other acts as a remote warehouse.
In this case you would need to enter Office in the first infobase as the code value
for this node of the RemoteWarehouses exchange plan (if the code length permits,
of course) and Warehouse1 in the second infobase. Thus, these nodes are assigned
names. But this is not enough; data exchange destination nodes need to be entered. To
accomplish this, a Warehouse1 node needs to be created in the RemoteWarehouses
exchange plan in the first infobase and an Office node – in the second infobase.
Thus, the first infobase "knows" that it is named Office in the RemoteWare-
houses exchange plan and is to exchange data with the Warehouse1 node; the
second infobase, on the other hand, knows that it is named Warehouse1 and is to
exchange data with the Office node.
Chapter 15. Data Exchange Mechanisms 2-761
The entire message is located within the Message XML item that belongs to the
http://v8.1c.ru/messages namespace. The message is divided into a header and
a body. Accordingly, the Message item contains two nested elements: Header and
Body. Both of them are associated with the "http://v8.1c.ru/messages" namespace.
The Header item contains the message header. The header's structure is hard-
coded. Header information is represented in several XML items nested
in the Header item. All items nested in the Header item are belong to the
http://v8.1c.ru/messages namespace.
ExchangePlan contains the name of the exchange plan with which the message
is associated.
To contains the code of the sender node.
From contains the code of the destination node.
MessageNo contains the number of the message. The message number is a
positive integer number assigned by the sender node. The number of each
subsequent message is the number of the preceding message incremented by 1.
ReceivedNo contains the highest message number that the sender node of the
message has received from the recipient node. This value is included in the
message header to confirm receipt of the message.
The body of the message is contained in the Body XML item which is associated
with the http://v8.1c.ru/messages namespace. The item's content is arbitrary and
depends on the application requirements. The message infrastructure does not
regulate the message body in any way.
2-762 1C:Enterprise 8.3. Developer Guide
Change Registration
As already noted, changes can be registered automatically when a data item
is recorded or deleted. Let us review how it is accomplished. Each object whose
changes can be recorded by the exchange plan has the DataExchange property
with the DataExchangeParameters type. This property can be used only for
reading only; it is intended for managing different parameters in data exchanges.
The DataExchangeParameters object has the Recipients property with the
NodeSet type. This property stores a list of nodes for which changes are recorded
upon data write or delete operations. The list of recipients is automatically filled
before either the BeforeWrite() handler (for data writing) or BeforeDelete()
handler (for deletion) is invoked. However, auto-fill only takes place if the
AutoFill property of the NodeSet object reads True (True is default for the
AutoFill property). Auto-filling includes references to all nodes of all exchange
plans with the corresponding metadata object in the recipient list provided that
the AutoRecord property is set to Enable. It goes without saying that the nodes
corresponding to the infobase are not placed on the recipient list. The recipient list
is cleared before auto-filling.
In the BeforeWrite() (and/or BeforeDelete()) handler, you can make changes
to the recipient list: add or remove node references. However, keep in mind that
the recipient list can only contain references to nodes associated with the exchange
plans containing the corresponding metadata object.
In the example below, the BeforeWrite() handler excludes a Special node of
the RemoteWarehouses exchange plan from the recipient list.
Procedure BeforeWrite()
Node = ExchangePlans.RemoteWarehouses.FindByCode("Special");
DataExchange.Recipients.Delete(Node);
EndProcedure
By assigning False to the AutoFill property, you can disable auto-filling for
the recipient list. In this case the recipient list can be managed both in the
BeforeWrite() handler and in any code fragment, as shown in the example:
Object = Ref.GetObject();
Node = ExchangePlans.RemoteWarehouses.FindByCode("Warehouse1");
Object.DataExchange.Recipients.AutoFill = False;
Object.DataExchange.Recipients.Add(Node);
Object.Write();
is a single node reference, then the second parameter can be omitted. In this case
change recording takes place for all data items currently existing in the database
and supporting change registration for the node.
This can be useful for organizing initial data transmissions to newly created nodes.
Node = ExchangePlans.RemoteWarehouses.FindByCode("New");
ExchangePlans.RecordChanges(Node);
If the first parameter is an array of references to nodes, then the second parameter
must be specified. However, the second parameter can still be used if the first param-
eter is a single node reference. Depending on how the second parameter is set,
changes can be recorded for one data item or all data related to one metadata object.
To record changes for a single item, you can use the data item itself, a reference to
the database object or an ObjectDeletion object as the second parameter.
If a data item is indicated, then its change is recorded. If a database object refer-
ence is indicated, then the change to this object is registered.
If the second parameter has the ObjectDeletion type, then changes are registered
for the database object referred to by ObjectDeletion.
Nodes = New Array(2);
Nodes[0] = ExchangePlans.RemoteWarehouses.FindByCode("Warehouse1");
Nodes[1] = ExchangePlans.RemoteWarehouses.FindByCode("Warehouse2");
Data = Catalogs.Nomenclature.FindByCode("KL00127");
ExchangePlans.RecordChanges(Nodes, Data);
To record changes for all data related to a metadata object, the corresponding
metadata object must be specified as the second parameter.
Nodes = New Array(2);
Nodes[0] = ExchangePlans.RemoteWarehouses.FindByCode("Warehouse1");
Nodes[1] = ExchangePlans.RemoteWarehouses.FindByCode("Warehouse2");
ExchangePlans.RecordChanges(Nodes, Metadata.Catalogs.Nomenclature);
Change registration records can be deleted for a specific data item for one or more
nodes.
Nodes = New Array(2);
Nodes[0] = ExchangePlans.RemoteWarehouses.FindByCode("Warehouse1");
Nodes[1] = ExchangePlans.RemoteWarehouses.FindByCode("Warehouse2");
Data = Catalogs.Nomenclature.FindByCode("KL00127");
ExchangePlans.DeleteChangeRecords(Nodes, Data);
2-766 1C:Enterprise 8.3. Developer Guide
Change registration records can also be deleted for all data related to a metadata
object for one or more nodes.
Nodes = New Array(2);
Nodes[0] = ExchangePlans.RemoteWarehouses.FindByCode("Warehouse1");
Nodes[1] = ExchangePlans.RemoteWarehouses.FindByCode("Warehouse2");
ExchangePlans.DeleteChangeRecords(Nodes, Metadata.Catalogs.Nomenclature);
In addition, if a single node is used as the first parameter, then the message
number can be used as the second parameter. In this case the DeleteChang-
eRecords() method deletes all records associated with the indicated nodes from
the change registration table if their message number is less than or equal to the
second parameter value (but not NULL). This method is used for deleting change
registration records for which change receipt has been confirmed by the node speci-
fied in the first parameter.
To check whether a data item change for a node has been recorded, use the
IsChangeRecorded() method. The first parameter of this method is a reference
to the node and the second parameter is the Data item, a reference to the database
object or ObjectDeletion.
Writing Data Exchange Messages
The ExchangeMessageWriter object is used for writing messages.
The ExchangeMessageWriter object is created using the CreateMessage-
Writer() method of the ExchangePlansManager object.
The ExchangeMessageWriter object has three methods:
BeginWrite()
EndWrite()
CancelWrite()
The BeginWrite() method has two parameters: the XMLWriter object used to write
the message and a reference to the message destination node. The BeginWrite()
method calculates the message number by adding 1 to the previous message number
and writes the beginning of the XML item containing the entire message, the entire
message header and the beginning of the XML item containing the message body.
After this you can begin writing the content of the message body.
To successfully complete the message write operation, use the EndWrite()
method. This method writes the end of the XML item containing the message body
and the end of the XML item containing the entire message. After the XML items
that complete the message are successfully recorded, the message is considered
submitted and its number is saved as the number of the last message sent from this
node to recipient node.
If the message writing operation has to be aborted and the message must not be
considered submitted, use the CancelWrite() method.
Chapter 15. Data Exchange Mechanisms 2-767
Below is a typical code fragment which writes a data exchange message.
XMLWriter = New XMLWriter();
XMLWriter.OpenFile(MessageFileName);
Node = ExchangePlans.RemoteWarehouses.FindByCode(NodeCode);
MessageWriter = ExchangePlans.CreateMessageWriter();
MessageWriter.BeginWrite(XMLWriter, Node);
// Writing the message body
MessageWriter.EndWrite();
The message body can contain any data represented in XML, depending on the
format used for a particular exchange plan. Below is an example of a message
containing data with changes registered by the change registration service. To
accomplish this, select the registered changes, tab through them and include the
XML representations of the data changes in the message.
The SelectChanges() method of the ExchangePlansManager object is used to
select changes. This method has two parameters: a reference to the node for which
the change is selected and the number of the message into which the changes must
entered. The SelectChanges() method returns a ChoiceData object which
contains the keys of the data with changes registered for the node passed as the first
parameter. Additionally the SelectChanges() method enters the message number
passed as the second parameter into the corresponding fields of the selected change
registration table records if these fields contain the NULL value.
If the change was already selected in the last cycle, then the message number
in the corresponding record of the change registration table is not modified;
however, if the change has not yet been selected, the system saves the number of
the first message with the selected changes.
To tab through change selections, use Next() and Get() methods. When the
Next() method is called, the next key in the selection comes up. The first time
the Next() method is called, the first key comes up. When the Get() method
is invoked, a data item corresponding to the current selection key is selected from
the database. Here it is worth making a separate comment on deleted database
objects. If a database object change was recorded as a result of deletion, then the
Get() method does not return the database object, but rather an ObjectDeletion
type object.
XML data items can be placed into the message using the global context
WriteXML() method.
Below is a code fragment in which a message is generated and recorded data
changes are placed into its body.
MessageWriter.BeginWrite(XMLWriter, Node);
Selection = ExchangePlans.SelectChanges(Node, MessageWriter.MessageNo);
While Selection.Next() Do
Data = Selection.Get();
WriteXML(XMLWriter, Data);
EndDo;
MessageWriter.EndWrite();
Below is a typical code fragment showing the use of the ExchangeMes-
sageReader object.
XMLReader = New XMLReader();
XMLReader.OpenFile(MessageFileName);
MessageReader = ExchangePlans.CreateMessageReader();
MessageReader.BeginRead(XMLReader, AllowedMessageNo.Greater);
// Reading the message body
MessageReader.EndRead();
As was earlier noted, the body of the message can, in principle, contain any infor-
mation, but in this case the body of a data change message is read. Sample code
fragment for reading a data change message is provided below.
XMLReader = New XMLReader();
XMLReader.OpenFile(MessageFileName);
MessageReader = ExchangePlans.CreateMessageReader();
MessageReader.BeginRead(XMLReader);
ExchangePlans.DeleteChangeRecords(
MessageReader.Sender, MessageReader.MessageNo);
While CanReadXML(XMLReader) Do
Data = ReadXML(XMLReader);
Data.DataExchange.Sender = MessageReader.Sender;
Data.DataExchange.Load = True;
Data.Write();
EndDo;
MessageReader.EndRead();
MessageReader.BeginRead(XMLReader);
ExchangePlans.DeleteChangeRecords(
MessageReader.Sender, MessageReader.ReceivedNo);
This logic is typical for data exchange. However, it is possible for message
delivery to be guaranteed. In this case change registration deletion must occur
immediately after successfully writing the message in order to avoid resending the
changes. A message can only be received if its number is the maximum number of
the previously received messages incremented by 1.
In this case the code fragment that records the message will look like the following:
XMLWriter = New XMLWriter();
XMLWriter.OpenFile(MessageFileName);
Node = ExchangePlans.RemoteWarehouses.FindByCode(NodeCode);
MessageWriter = ExchangePlans.CreateMessageWriter();
MessageWriter.BeginWrite(XMLWriter, Node);
Selection = ExchangePlans.SelectChanges(Node, MessageWriter.MessageNo);
While Selection.Next() Do
Data = Selection.Get();
WriteXML(XMLWriter, Data);
EndDo;
MessageNo = MessageWriter.MessageNo;
MessageWriter.EndWrite();
ExchangePlans.DeleteChangeRecords(Node ,MessageNo);
The code fragment in which the message is received looks like the following:
XMLReader = New XMLReader();
XMLReader.OpenFile(MessageFileName);
MessageReader = ExchangePlans.CreateMessageReader();
MessageReader.BeginRead(XMLReader, AllowedMessageNo.Next);
While CanReadXML(XMLReader) Do
Data = ReadXML(XMLReader);
Data.DataExchange.Sender = MessageReader.Sender;
Data.DataExchange.Load = True;
Data.Write();
EndDo;
MessageReader.EndRead();
Please keep in mind that the organization of guaranteed message delivery is quite
complicated and in most cases it is preferable to simply send changes repeatedly
until their receipt has been confirmed.
Collision Resolution
In the above examples of reading and writing messages, we did not take into
account that in data exchange one item could be modified in two data exchanging
nodes at the same time. In this case it is impossible to tell which change should be
accepted in the end. This situation is called a collision.
Chapter 15. Data Exchange Mechanisms 2-771
One of the ways to resolve collisions is by defining one of the nodes as a master
and the other as a slave. In this situation the change made in the master node must
be accepted and the change made in the slave node – rejected.
To implement this, upon receiving the message and before recording the data find
out whether the change of these data has been recorded and, depending on the role
of the node in this sender-recipient pair, make the decision as to whether data must
be written or not.
An example of using the "master-slave" strategy in reading messages is provided
below. Here, to save the role of the node in the exchange plan, the Master attribute
with the Boolean type has been defined.
XMLReader = New XMLReader();
XMLReader.OpenFile(MessageFileName);
MessageReader = ExchangePlans.CreateMessageReader();
MessageReader.BeginRead(XMLReader);
ExchangePlans.DeleteChangeRecords(MessageReader.Sender, MessageReader.MessageNo);
Sender = MessageReader.Sender;
Master = Sender.Master;
While CanReadXML(XMLReader) Do
Data = ReadXML(XMLReader);
If Master Or
Not ExchangePlans.IsChangeRecorded(Sender, Data)
Then
Data.DataExchange.Sender = MessageReader.Sender;
Data.DataExchange.Load = True;
Data.Write();
EndIf;
EndDo;
MessageReader.EndRead();
XMLWriter.WriteNamespaceMapping("xsi",
"http://www.w3.org/2001/XMLSchema-instance");
XMLWriter.WriteNamespaceMapping("v8",
"http://v8.1c.ru/data");
Selection = ExchangePlans.SelectChanges(
Node,
MessageWriter.MessageNo);
While Selection.Next() Do
Data = Selection.Get();
WriteXML(XMLWriter, Data);
EndDo;
MessageNo = MessageWriter.MessageNo;
MessageWriter.EndWrite();
ExchangePlans.DeleteChangeRecords(Node ,MessageNo);
In some cases this approach can help to significantly reduce the size of the XML
document containing the data exchange message.
Any changes to the configuration are allowed only in the root node. Subsequently,
they are distributed over the hierarchy, from the root node to its subordinates,
etc. In this manner, the distributed infobase management tool assures the same
configuration for all nodes of the distributed infobase.
Data change is allowed in each node of the distributed infobase. Data synchroni-
zation takes place through the distribution of data changes made in one node to all
structures of the distributed infobase.
When configuring document sequence functions in a distributed infobase, note
that a document's membership in a document sequence makes sense only in a
single node of a distributed infobase. It can be a node where the document was
created or some other node, but in any case only one. Violating this rule may result
in various problems while you are working with the system, such as failure to
restore the document sequence.
If complete configuration duplication is supported in the framework of all the
distributed infobase, then complete data duplication is not required. The content of
data for which changes are transferred in the framework of the distributed infobase
can be regulated "vertically" (by defining multiple metadata objects for which data
are exchanged) or "horizontally" (by assigning conditions for change transmission
and receipt at the level of individual data items).
is perform – this item is not entered into the database and the change registration
record is not deleted.
If the message from the master node contains a data item with changes that have
been registered for the master node, then this data item is recorded in the database
and the change registration record is deleted.
<v8msg:MessageNo>20</v8msg:MessageNo>
<v8msg:ReceivedNo>15</v8msg:ReceivedNo>
</v8msg:Header>
<v8msg:Body>
<v8de:Changes xmlns:v8de="http://v8.1c.ru/dataexchange">
<v8de:Signature>
7b4d5320-f69c-4a7b-9273-ff56607fc8ab</v8de:Signature>
<v8de:Config xmlns:v8md="http://v8.1c.ru/metadata">
<!– Modified configuration objects -->
<v8de:Digest1>88d3f3a6ba3f4df03c7ec00f154837fc</v8de:Digest1>
<v8de:Digest2>00cf636b02a488103a64c7a2cf81069e</v8de:Digest2>
</v8de:Config>
<v8de:Nodes>
<v8de:Node>
<!– Master node data -->
</v8de:Node>
<v8de:Node>
<!– Slave node data -->
</v8de:Node>
</v8de:Nodes>
<v8de:Data>
<!– Modified data items -->
</v8de:Data>
</v8de:Changes>
</v8msg:Body>
</v8msg:Message>
As you can see from the example, all the differences in the data exchange message
are concentrated in the body of the message. The body of the message (the Body
item, associated with the http://v8.1c.ru/messages namespace) contains a single
XML item – Changes belonging to the http://v8.1c.ru/dataexchange namespace.
All data transferred during data exchange in the distributed infobase is contained
within this element:
The Changes item can contain four nested items associated with the same
namespace.
○○ The Signature item contains the "signature" of the exchange plan used to
receive the message.
○○ The Config item contains configuration changes as well as data that iden-
tify the status of the configuration.
○○ The optional Metadata items nested in Config contain changes of indi-
vidual configuration objects. If configuration changes are not transferred
in the message, then the Metadata items are not used. These items can
only be included in messages transferred from the master node to the slave
node. The Digest1 and Digest2 items contain numerical signatures for
configuration changes transferred in the message and for the entire configu-
ration except modifications. The Digest1 and Digest2 items are included
in all messages sent from the master node to the slave mode and vice versa.
Chapter 15. Data Exchange Mechanisms 2-777
The Nodes item can only be included in messages transferred from the master
node to the slave node. This item contains two nested Node items, the first
containing data for the master node (sender) and the second – for the slave
(recipient).
Finally, the Data item contains data item changes transferred in the message.
Data items are entered into the message using XML-serialization.
The OnSendDataToMaster event handler differs from the previous one only in that
it is used when entering a data item into a message sent to the master node.
The OnReceiveDataFromSlave handler is used after reading a data item from
the message and before recording it in the database. The first parameter contains
the data item read from the message. The second parameter, upon handler invoca-
tion, has the DataItemReceive.Auto value corresponding to the default behavior.
If no data item changes have been registered in this node for the sender node,
then the item is recorded in the database. If there have been recorded changes,
then the item is not recorded in the database. The value of the second parameter
can be modified by the handler. If the second parameter is assigned the DataIt-
emReceive.Accept value, then the data item is recorded in the database regard-
less of whether the changes have been registered for the sender node. If changes
have been registered, then the corresponding change registration record is deleted.
If the second parameter is assigned the DataItemReceive.Ignore value, then
nothing happens (the item is not recorded in the database and no actions are
performed with the change registration records). The third parameter manages data
item change recording for the sender node. When the handler is invoked, this param-
eter is False. If the handler does not modify this value, then no additional actions are
performed. If the True value is assigned to the parameter in the event handler and no
data item changes have been recorded for sender node, registration takes place.
The OnReceiveDataFromMaster event handler has the same set of param-
eters as the previous handler, but differs from it in that it is used when reading
messages received from the master node of the distributed infobase. Accord-
ingly, there are several different activities carried out when receiving data items.
The DataItemReceive.Auto and DataItemReceive.Accept values of the
second parameter produce a similar effect since with the accepted collision resolu-
tion strategy dictates that the slave node data item read from the message must be
recorded in the database regardless of whether its changes have been registered.
All the other parameter values and activities are similar to those described above.
Additionally a master node can be set and, therefore, retrieved for each node of the
distributed infobase. This operation cannot be classified as the main operation in a
distributed infobase, that is why it has no corresponding interactive action.
This is all based on the principles for distributed infobases where separate data
exchange messages can be lost, but the same message cannot be received more than
once.
The maximum number of data items read from the message and entered into
the database in one transaction can be used as the optional second parameter.
The default parameter value is 0, it signifies that all message reading takes place
in a single transaction. If message reading occurs in a single transaction and errors
occur, it is not possible for only part of the data items to be read from the message
and entered into the database. But it could be that there are too many database
changes that need to be completed in one transaction. There is also an increased
probability of conflicts between the message reading transaction and transactions
of other users. To avoid these problems, the number of data items processed in a
single transaction can be limited. But if this is not absolutely necessary, we recom-
mend using the default mode to read all data items in one transaction.
The following could be a sequence of activities carried out by the ReadChanges()
method:
The exchange plan "signature" is read and checked to ensure that the message
was received from the expected exchange plan with the expected configuration.
Configuration changes are read from the message. The numerical signature of
the configuration is checked to avoid any possibility that incompatible configu-
rations are located in the sender node and the current node of the distributed
infobase. For each changed configuration object that was read, the system
checks to see if this configuration object has been actually changed. As
a reminder, modified configuration objects can only be contained in messages
sent from the master node to its slave.
Change registration records for messages with confirmed receipt are deleted.
As a reminder, the maximum number of messages accepted by the sender node
is given in the message header and is accessible through the ReceivedNo
property of the ExchangeMessageReader object.
If it can be established, through checking the numerical signature, that the
configuration in the current node of the distributed infobase is different than
the configuration of the sender node, then there are two possible actions:
○○ If the current node is the master node in relation to the sender node, then
it is not possible to receive this message in the future under any circum-
stances.
○○ If the current node is the slave node in relation to the sender node, then
before continuing to receive the message, the configuration of the database
must be refreshed to the configuration of the sender node. In updating the
configuration database, configuration objects previously received, saved and
changed are transferred. In both cases an exception is raised, with a corre-
sponding error message. If the message cannot be read in the first case, then
in the second case the same message can be successfully read and received
2-782 1C:Enterprise 8.3. Developer Guide
after updating the database configuration which can be accomplished in the
Designer mode.
If a data exchange message sent from the master node of the distributed
infobase is being received, then the current node data and the sender node data
are brought into compliance with the data about these nodes contained in the
data exchange message. If the data exchange message has been received from
the slave node, then these data should not be there (for more information see
page 2-775).
Data items are read from the message and recorded in the database.
The message can only contain data items corresponding to metadata objects
entered into the content of the exchange plan associated with this message.
For each of the data items read from the message, the OnReceiveData-
FromMaster (OnReceiveDataFromSlave) event handler is called for the
ExchangePlansObject.<Exchange plan name> type object. Future activi-
ties in each of the data items are defined by the handler operation results (for
details see page 2-777).
To execute each of these commands, select the exchange plan node the command
is to be applied to in the list and click the corresponding More (All actions) menu
option.
The More – Create initial image (All actions – Create initial image…) command
can be used to create an initial image of the slave node in a distributed infobase.
After using this menu point, a dialog appears asking you to select the location type
of the infobase and its parameters (if the image is to be created in the client/server
mode). After clicking the Create initial image button, the initial image is created.
The procedure for creating an initial image interactively is not different from
the procedure used by the CreateInitialImage() method of the Exchan-
gePlansManager object.
The More – Write changes… (All actions – Write changes…) command is used to
write the data exchange message to a file. After using this menu point, a dialog
appears. It prompts the user to enter the number of data items to be processed
in one transaction. After this, click Write and save to file. It opens the exchange
file selection dialog box. Select the file and click Open to start data download.
The More – Read changes… (All actions – Read changes…) command is used to
read data exchange messages from a file. After using this menu point, a dialog
box appears. It prompts the user to enter the number of data items to be processed
in one transaction. After this, click Select file and read changes. It opens the
exchange file selection dialog box. Select the file and click Open to start data
upload.
All data download/upload operations (including creation of an infobase initial
image) are performed on the 1C:Enterprise server side.
2-784 1C:Enterprise 8.3. Developer Guide
In order for Invoice documents not to end up in the wrong slave nodes, the
OnSendDataToSlave event handler must look like the following:
Procedure OnSendDataToSlave(DataItem, ItemSend)
DataType = TypeOf(DataItem);
If ValueType = Type("DocumentObject.Invoice") Then
ItemSend = DataItemSend.Delete;
EndIf;
EndIf;
EndProcedure
In the example above, the handler analyzes the data item type and if it is equal
to DocumentObject.Invoice, then the Warehouse attribute value of the docu-
ment is compared with the Warehouse attribute value of the exchange plan.
If the attribute values are equal, you do not have to modify the ItemSend parameter
value (upon invocation, this parameter has the DataItemSend.Auto value). In this
case the document's XML-representation is entered into the message. If, however,
the attribute values do not match, the ItemSend parameter is assigned the
DataItemSend.Delete value. In this case an XML representation of the
ObjectDeletion object is placed in the message and initialized with a reference
to an appropriate Invoice document.
It may seem strange that when the Warehouse attributes are not equal, the
DataItemSend.Delete value is assigned to the ItemSend parameter instead
of the DataItemSend.Ignore value, as with the DataItemSend.Delete
value selected XML-representation of the ObjectDeletion object is placed
into messages sent to all slave nodes except the node the document is sent to.
Therefore, most of the time ObjectDeletion is sent to the nodes where the docu-
ment to be deleted has never existed.
This is accurate, but this is the most ordinary case. If, for example, you know
that the Warehouse attribute value of the Invoice document can be set only
when creating the document and cannot be changed in the future, then the
DataItemSend.Ignore value could have been assigned to the ItemSend param-
eter in this handler.
If the Warehouse attribute value of the Invoice document can be modified in the
slave node, then the OnReceiveDataFromSlave event handler must be defined
in the exchange plan as follows:
Procedure OnReceiveDataFromSlave(DataItem, ItemReceive, SendBack)
DataType = TypeOf(DataItem);
If ValueType = Type("DocumentObject.Invoice") Then
2-786 1C:Enterprise 8.3. Developer Guide
SendBack = True;
EndIf;
EndIf;
EndProcedure
In the example above, the handler analyzes the data item type and if it is equal
to DocumentObject.Invoice, then the Warehouse attribute value of the docu-
ment is compared with the Warehouse attribute value of the exchange plan.
If the attribute values are equal, then the values of the ItemReceive and Send-
Back parameters do not have to be modified, assigning the default behavior upon
receiving the data item. If the attribute values are not equal, then the SendBack
parameter is assigned the True value. In this case registration of document
changes is guaranteed and the ObjectDeletion object is sent to the slave node
with the message if, of course, the Warehouse attribute is not modified in the
master node so that it is equal to the value of the Warehouse attribute corre-
sponding to the exchange plan node.
If the value of the Warehouse attribute in the Invoice document cannot be modi-
fied after creating the document, then the OnReceiveDataFromSlave handler do
not have to be defined.
DataType = TypeOf(DataItem);
If ValueType = Type("DocumentObject.Invoice") Then
ItemReceive = DataItemReceive.Accept;
EndIf;
EndProcedure
Chapter 15. Data Exchange Mechanisms 2-787
This handler is quite simple: the data item type is checked and if the data item
is of the right type, then the DataItemReceive.Accept value is assigned to
the ItemReceive parameter to unconditionally receive data items regardless of
whether its changes have been registered.
The OnReceiveDataFromMaster event handler looks like the following:
DataType = TypeOf(DataItem);
If ValueType = Type("DocumentObject.Invoice") Then
If ExchangePlans.IsChangeRecorded(Ref,DataItem)
Then
ItemReceive = DataItemReceive.Ignore;
EndIf
EndIf;
EndProcedure
This handler is slightly more complicated. If the data item belongs to the required
type, a check is run to see if the changes in the data item have been registered
in the message sender node. If the changes are have been registered, then the
DataItemReceive.Ignore value is assigned to the ItemRecieve parameter.
As a result, the data item read is not recorded in the database, but the change
recording is saved to allow you to enter the data item in the message sent to the
master node.
XDTO MECHANISM
The XDTO mechanism is a universal data presentation method that interacts with
various external data sources and software systems.
XDTO stands for XML Data Transfer Objects.
Use the XDTO mechanism to create a data representation model (model of types
and values) that, on the one hand, provides easy and natural data manipulation
in the 1C:Enterprise environment and, on the other hand, can be adapted for trans-
parent data conversion to other formats, mostly XML.
There are several tasks for which the XDTO mechanism is used:
Data exchange between the 1C:Enterprise configurations and other consider-
ably different data schemas;
2-790 1C:Enterprise 8.3. Developer Guide
Data exchange based on XML schemas that are not linked to any configuration
(e.g., data exchange with information systems that aren’t built on the basis of
1C:Enterprise);
Organization of work with Web services. Use the XDTO mechanism to describe
the types of parameters and return values of Web services and to manipulate
transferred and returned data.
The XDTO mechanism has the following key properties:
Supports work with XML;
Provides a typical model of working with data.
At present, data exchange with various software platforms and systems is imple-
mented using XML: XML documents are used to represent data, whilst an XML
schema is used to describe formats and data structure. Use the XDTO mechanism
to create XML schemas that are required for data exchange and generate XML
documents for these schemas.
At the same time, you can use the XDTO mechanism to execute these actions
in the manner which is usual for most 1C:Enterprise developers.
Developers deal with data objects and types; data objects contain properties for
which values are set, etc. When manipulating data using XDTO, the developer
is to a greater extent isolated from the details connected with how these data
are presented in XML. Of course, it is impossible to eliminate these details
completely, but an important point is that they manifest only where it is really
necessary.
The scenario of adding XDTO types to the factory one by one or in groups is not
supported.
Below is an example of creating the XDTO factory based on the XML schema
contained in the XML file. Since the XDTO mechanism is an abstraction built
"above" XML, it is necessary to "go through" several levels of work with the
XML data in sequence to obtain an XML schema from an XML file:
First, low-level reading/writing of XML files;
Then, the XML object model from which you can obtain the 1C:Enterprise
script XMLSchema object that contains the XML schema data.
Example:
// Create the XDTO factory based on the XML schema
// contained in the XML file
NewXMLSchema = NewXMLSchemaBuilder.CreateXMLSchema(NewDOMDocument);
In the above example, the XMLReader object is created first and the XML file
located in the disk is opened. After that, use the DOM document builder to create
a DOMDocument object containing the XML file data. Then use the XML schema
builder to create a new XMLSchema object containing XML schema data on the
basis of the DOM document. Finally, create an empty set of XML schemas, add the
existing XML schema to it and use the set to create the XDTO factory.
Unlike an arbitrary XDTO factory that a developer can create, the global XDTO
factory is created automatically by the system when a new infobase is created;
you can add one or several XDTO types to such a factory. Use the visual construc-
tion tools to add XDTO packages to the Common – XDTO packages metadata tree
branch. All packages in the global XDTO factory can be divided into three types:
An XDTO package containing the description of the platform types. It is iden-
tical for all the configuration in the 1C:Enterprise system;
An XDTO package containing a description of the configuration types created
as a result of metadata editing (creation and modification of properties of cata-
logs, documents, etc.);
A single or multiple XDTO packages described directly in the configuration
tree, in the Common – XDTO packages branch.
An XDTO package contains a description of a set of types belonging to a single
namespace, i.e., a package namespace. In addition to the type descriptions, the
XDTO package can contain references to the packages used by this package and
a list of global package property definitions.
References to other packages are contained in the Dependencies property
of the XDTO package and represent the XDTOPackageCollection object. Pack-
Chapter 16. XDTO Mechanism 2-793
ages from this collection include types from the namespace referenced in this
package.
A package can contain references to global properties from other packages.
directly or indirectly inherited from this type. The types generated by mergers
or lists are always directly inherited from anySimpleType;
Facets – is a list of facets restricting a set of valid values towards the base
type. A list of facets is specified only for the XDTO value types defined by the
restriction of the base type. Every facet is a pair, a facet name and a value.
A list of names for valid facets is defined. There are certain limits as to how
valid facets can be applied to any type. The list of facets and their applicability
to a certain type comply with the rules of the XML Schema (http://www.w3.org/
TR/xmlschema-2/);
MemberTypes is a list of types that form a merger. Only XDTO value types
can become unions. If a type is formed by a merger, the MemberTypes list
contains at least one type. The Facets list must be empty and the ListItem-
Type property must return an undefined value;
ListItemType – if the XDTO value type is defined by the list, then this
property shows the list item type. Facets and the MemberTypes lists must be
empty.
A list of valid facets (that is defined by the XDTOFacetType system enumera-
tion):
○○ Length – the length facet. It contains a number of units of length, with
a unit of length having a different meaning for different types. For string
and anyURI types, the length contains a number of characters. For hexBi-
nary and base64Binary types, the length contains a number of binary data
bytes. For types defined by the list, the length contains a number of list items;
○○ MaxInclusive – a facet of the maximum including the boundary.
It restricts the space of the values of this type with the maximum value. Any
value of this type is either less or equal to the specified value;
○○ MaxLength – maximum length facet. It contains a maximum number
of units of length, with a unit of length having a different meaning for
different types. For the string type, the maximum length contains the
maximum number of characters. For hexBinary and base64Binary types,
the maximum length contains the maximum number of binary data bytes.
For types defined by the list, the maximum length contains the maximum
number of list items;
○○ MaxExclusive – a facet of maximum, not including the boundary.
It restricts the space of the values of this type with the maximum value. Any
value of this type is less than the specified value;
○○ MinInclusive – facet of the minimum including the boundary. It restricts
the space of the values of this type with the minimum value. Any value of
this type is either more or equal to the specified value;
○○ MinLength – minimum length facet. It contains the minimum number
of units of length, with a unit of length having a different meaning for
different types. For the string type, the minimum length contains the
Chapter 16. XDTO Mechanism 2-795
Abstract – this flag specifies if the XDTO object type is abstract. It corre-
sponds to the use of abstract="true" attribute for this item in the schema;
Ordered – this flag specifies if the order of items that represent property
values strictly corresponds to the order of properties in the XDTO object type.
If the xsd:all content model is set, the order of XML items can be arbitrary.
The order corresponding to the order of properties in the type is also valid, i.e.
if the Ordered property is False, on input the order of the XML items is not
controlled, whilst on output it is defined by the order of the properties, unless
the Sequenced flag is True;
Sequenced – this property shows if an instance of the relevant XDTO object
contains an XDTO sequence. This flag is True when the order of nested XML
items cannot be uniquely defined by the order of the properties in the type (e.g.,
the content is set as <sequence … maxOccurs=10 … > in the XML schema)
or the mixed="true" attribute is defined for the corresponding XML type in the
schema. Use the XDTO sequence to expressly set the order of items in the
XML document. The order of the nested items corresponds to the order of
properties for objects of the types for which the Sequenced property has the
False value;
Mixed – this property shows if mixed content is defined for this type in the
XML schema. If the Mixed property setting is True, then the Sequenced value
is always True, because mixed content cannot be modeled without using an
XDTO sequence;
Properties is a list of properties defined for this XDTO object type. Each
of the properties is presented as the XDTOProperty object instance. The list
contains a full list of properties including those defined in the base type.
There is a predefined XDTO object type with the anyType name and URI of the
http://www.w3.org/2001/XMLSchema namespace. This type is the base type for
any XDTO object type, but it has no base type of its own. It is open, not abstract,
implies a sequence and has an empty list of properties.
This XDTO object type corresponds to anyType defined in "XML Schema Part 2:
Datatypes".
When an XDTO data model is created on the basis of the XSD schema, XDTO
property names are formed on the basis of the names of attributes and elements
described in that schema. A model type is built sequentially: an attribute based
list of properties is created first, then an item based list of properties, in the
order of the schema declaration. The name complies with the naming conven-
tions of the script. Characters that are accepted in an XML-name (".", "-", for
instance) but that are not accepted from the point of view of script names are
replaced with "_". If attribute and item names are copied, a copy is assigned
a name extended with a numerical suffix (starting from 1).
Type – a property type. It can be either XDTOValueType object instance or
XDTOObjectType object instance;
UpperBound – this property of an XDTO object type can be defined as
containing one or multiple values. The property is considered to contain one
value if set to 1. If the UpperBound property is greater than 1, it is considered
to be able to contain multiple values. This property is modeled as a list in the
object structure (be sure not to confused it with the list in the description of
the XDTO value type). The UpperBound property shows the maximum
number of property values. Its value can be greater than 1 only if the property
is represented as an XML item. The UpperBound property corresponds to the
xsd:maxOccurs attribute in the XML Schema. A value of -1 corresponds to
unbounded;
LowerBound – the minimum number of property values. The minimum
number of property values can take values of >= 0. Of course, the LowerBound
value must be less than or equal to the UpperBound value (unless
the UpperBound value is -1);
Nillable – shows if the property can take an undefined value. An unde-
fined property value is represented in XML as the following item:
<elem xsi:nil="true" />. Therefore, the Nillable property set to True can only
be defined for properties with the Item presentation form. The Nillable
property corresponds to the xsd:nillable attribute in the XML Schema.
If UpperBound is greater than 1, property value list items can have an unde-
fined value;
DefaultValue – default property value. The default property value can only be
XDTODataValue. This value must be of the same type as the property type or
of the inherited type. When the XDTO object is created, the property allowing
the only value takes the default value (the IsSet() method of the XDTO object
returns False for this property). For properties with multiple values, a list of
values is initially empty, irrespective of whether the default value is defined;
Fixed – specifies if the property value is fixed. If it is set to True, the fixed
value can be obtained through the DefaultValue property;
Form is the form of property presentation in XML. It can be Text, Item or
Attribute. If the presentation form is Attribute or Text, the value of the
2-798 1C:Enterprise 8.3. Developer Guide
UpperBound property cannot exceed 1. If the property has the Text value, then
the value of the LowerBound property is also equal to 1. Only one property of
an individual type can have its presentation form set to Text, while all the other
properties must have their presentation form set to Attribute;
LocalName is the local name of an attribute or item used for property presenta-
tion. For properties with the Text presentation form, it is an empty string;
NamespaceURI – the URI of the namespace for an attribute or item used for
property presentation. It is an empty string if there is no namespace.
You can also obtain a new XDTO value by reading the XML file.
Example:
GlobalXDTOFactory = XDTOFactory;,
NewXDTOValue = GlobalXDTOFactory.ReadXML(NewXMLReader);
You can write an XDTO value to the XML file.
GlobalXDTOFactory = XDTOFactory;
GlobalXDTOFactory.WriteXML(NewXMLWriter, NewXDTOValue);
NewХDTOObject.Description = CatalogObject.Description;
NewХDTOObject.FullDescr = CatalogObject.FullDescr;
NewХDTOObject.PurchasePrice = CatalogObject.PurchasePrice;
NewХDTOObject.Barcode = CatalogObject.Barcode;
You can also read the XDTO object data from the XML file or write in the XML
file, the way it is done with the XDTO value.
Example:
GlobalXDTOFactory = XDTOFactory;
NewXMLReader.OpenFile("D:/Exchange.xml");
…
NewХDTOObject = GlobalXDTOFactory.ReadXML(NewXMLReader);
…
GlobalXDTOFactory.WriteXML(NewXMLWriter, NewХDTOObject);
When non type-safe data is read, the element is read into XDTOObject of the
xsd:anyType type if there are attributes or child elements. This is an open type
with mixed content, so the text in the element is interpreted as text and inserted
into the object’s sequence, not as a value of property __content.
For instance, if an element of type <element attr="attr_value">element value</
element> is read, text element value can be obtained the following way: XDTOOb-
ject.Sequence().GetText(0).
XDTODataObject contains the following methods:
Type() – returns the type of this XDTO object (XDTOObjectType);
Set(<Expression>), Set(<Property>, <Value>) – use these methods to
specify the property value:
○○ Expression – the Xpath expression specifying the property;
○○ Property – the property name;
○○ Value – the specified property value.
If Expression is set incorrectly or Value cannot be assigned to the property
(e.g., the type is incompatible with the property type), an exception is raised.
If an undefined value is assigned to the property, whilst the Nillable property
is False, an exception is raised. If a reference to an XDTO object is assigned
to the property and the reference to this XDTO object is already a value of any
other property, this reference stops being the value of the other property.
Chains of references to XDTO objects contained in the object properties cannot
form cycles. Therefore, when a reference to an XDTO object is assigned and
a cycle is formed, an exception is raised. If the property can have multiple
values, you cannot use the Set() method for it as it raises an exception.
When a value is assigned to the property, it is checked to see if this value
type is allowed for the property. The value can be assigned if its type matches
the property type, is inherited from the property type or is one of the types
included in a merger. When assigning, if the property presentation form
in XML is Text or Attribute, the value is converted to the property type.
If the presentation form is Item, the value is assigned as is.
Get(<Property>), Get(<Expression>) – obtains the property value:
○○ Property – the property name;
Chapter 16. XDTO Mechanism 2-801
16.3.5. XРath
Use XPath expressions to navigate the object tree. It is not exactly XPath, but
a slightly modified XPath subset.
The main construct of this language is a value path which consists of certain steps.
The path steps are separated by the / (slash) character. The property name or
predefined period (.) and two-period (..) constructs are used as path steps.
An expression shown below means a PropertyName property of the current
object, i.e. the object for which Get() or Set() method has been called.
PropertyName
An expression shown below means that the PropertyName1 property value has
been obtained for the current object and the PropertyName2 property value has
been obtained for the object referenced by the PropertyName1 property value.
PropertyName1/PropertyName2
Therefore, the step marked by a period represents the current object, while two
periods stand for its owner object.
If a search path starts with the slash character, it means that the search begins at
the object tree root. If any property is not found in the path, an exception is raised.
If the path includes a property with multiple values, the result is the entire list of
values for this property.
For example, if the path below contains the List property with multiple values, the
result of this expression is the list of values (XDTOList) for this property.
Property/List
To obtain a certain value from this list, specify a 0-based value index over the
period from the property name in the list as shown below.
Property/List.0
The index must be specified as an integer falling in the range of allowed indices.
Otherwise an exception is raised.
A certain list value can be obtained using a 1-based index. The following construct
can be used:
Property/List[1]
Here List is the property with multiple values. List values are objects having
a PropertyName property. The result is the first object in the list with the Prop-
2-804 1C:Enterprise 8.3. Developer Guide
erty property value equal to 'SearchString'. If no object is found, the result
is an undefined value. Not all list objects can have the PropertyName property.
Sometimes there are no objects with such a property. The value with which the
property value is compared can be specified as a number, a logical value (True or
False) or a string literal.
Property/List[PropertyName!='SearchString']
The above expression is similar to the previous example, with the exception that
the result is the first object in the list with its PropertyName property value
different from 'SearchString'.
Below is the definition of the described XPath subset.
<Path>
[/] <Step List>
<Step>
<Property Name> [<Qualifier>] | .. | . |
<Property Name>
[<Letter> | _]<Name balance>
<Name Remain>
{<Letter> | <Digit> | _} <Name remain > |
<Qualifier>
.<0-based index> |
[<Property Name>=<Value>] |
[<Property Name>!=<Value>] |
[<1-based index>]
<0-based index>
<Integer without sign>
<1-based index>
<Integer without sign>
<Digit>
0|1|2|3|4|5|6|7|8|9
<Digits>
<Digit> <Digits> |
<Value>
<Number> | <String> | <Boolean>
<Number>
[+|-]<Integer without sign>[.<Integer without sign>]
<String>
"<Characters>" | '<Characters>'
<Boolean>
true | false
NOTE
In a string with double quotation marks (") used as delimiters, double quotation
marks cannot be used among other characters. Similarly, in a string with single
quotation marks (') as delimiters, single quotation marks cannot be used among
other characters.
When the property value is compared with the value specified as a literal, the
latter is converted into the property type according to the conversion rules and then
comparison is performed.
</sequence>
</complexType>
</element>
The all model does not violate the identity of the source and resulting schemas
during XMLSchemaSet → XDTOFactory → XMLSchemaSet conversion. However,
it has some limitations. Specifically, the maxOccurs attribute in the all model
cannot be greater than 1.
The selection model violates the identity of the source and resulting schemas and
does not make it possible to check whether the object data meets the XML schema
requirements using the Validate() method.
For the same reasons it is not recommended to use multiple content models within
a single complex type or define non-default minOccurs and maxOccurs attribute
values for sequence.
We recommend you present object properties as XML elements
Representation of properties as XML attributes has no influence on the identity of
the source and resulting schemas. However, there are some limitations:
an attribute cannot contain object type values, it can only contain value types;
an attribute cannot contain properties with multiple values;
value type can get distorted if the property represented as an XML attribute has
polymorph types, i.e. when a value is assigned to the property, the value type
is cast to the property type as the XML item permits specifying the xsi:type
attribute (that specifies the exact property value type) only for property values.
Therefore, it is not necessary to use simpleContent for complexType, as this
model implies use of XML item attributes and text to store values.
We recommend that you do not use similar names to declare an attribute and an
element. For XDTO property naming rules, please see page 2-796.
2-808 1C:Enterprise 8.3. Developer Guide
Information content of this type for the relevant XDTOObjectType is supported by
setting Sequenced and Mixed properties to True and obtaining XDTO sequence
(XDTOSequence object) for each instance of the corresponding XDTODataObject
object. It is much harder to manage the information content of such objects than
that of the objects with the state represented by a property value set.
Fortunately, in most cases it is not necessary to use mixed content.
The ElementFormDefault property for XML schema must be set to Qualified.
This recommendation is an element of good style and XDTO follows this style.
16.6. XDTO FACTORY CHECK RULES
A general schema of coding identifiers for XDTO factory check error messages
looks like the following:
xdto-<area>-<section>[-<rule>]: <error description>
<area> is the check area (XDTO factory, XDTO package, XDTO value type,
XDTO facet or XDTO object type);
<section> is the number of the section which resulted in failure after the check;
<rule> is a section rule;
<error description> is an error description.
Packages within the model should have unique namespace URIs – duplicate pack-
ages are not allowed in the model.
Import directives should determine non-empty namespace URIs of imported packages.
Package import directives should define the existing type packages.
Type packages defined in the model should meet the package check rules.
16.6.2. XDTO Package Check Rules
When XDTO packages are checked for correctness, error codes are prefixed with
package. A general prefix looks like the following:
xdto-package-<section>[-<rule>]: <error description>
Chapter 16. XDTO Mechanism 2-809
Inheritance of XDTO value types is considered correct if the following require-
ments are met:
The following conditions should be met for atomic types of XDTO values
(ListItemType and MemberTypes properties are not set after execution of the
rules for checking the list item type and the union type):
○○ Base XDTO value type should be atomic, i.e. its ListItemType and
MemberTypes properties should not be set.
○○ Ancestor of the XDTO value type should be one of primitive types of the
XML schema namespace (http://www.w3.org/2001/XMLSchema).
○○ Content of the facets specified in the XDTO value type description should
match the list of valid facets for the primitive type which is the ancestor of
this XDTO type.
○○ Value of each facet specified in the XDTO value type should comply with
the limitation rules for effective values of similar facets of the XDTO base
types.
For the list item types (the ListItemType property is set after execution of
the rules for checking the list item type and the union type):
□□ Base XDTO type cannot be a union type, i.e. its MemberTypes property
should not be set.
□□ If the ListItemType property of the XDTO base type is set, its value
should determine the base type for the list item type defined in the
ListItemType property of this XDTO value type.
□□ If anySimpleType is the base type of the XML schema namespace
(http://www.w3.org/2001/XMLSchema), it is allowed to use only the
Whitespace facet out of the facet list.
□□ Otherwise only the following facets can be defined: Pattern, Enum,
Length, MinLength, MaxLength and Whitespace.
□□ Value of each facet in the type should comply with the limitation rules for
the effective value of similar base-type facets.
○○ For union types (the MemberTypes property is set after execution of rules
for checking the list item type and the union type):
□□ anySimpleType of the XML schema namespace (http://www.w3.org/2001/
XMLSchema) or a union type can be the base type, i.e. the base type
should have the MemberTypes property set.
□□ If the base type is a union type, the following requirements should be
met:
The number of union types for the base type should not be greater
than the number of union types for this type.
Union types should be descendants of their corresponding base type
union types, in accordance with the union type list order.
2-812 1C:Enterprise 8.3. Developer Guide
Each property of the XDTO object type should meet the following conditions:
Property name should be defined.
Property name cannot be empty.
Property name should be unique for the XDTO object type.
If the Type property is set, it should meet the following conditions:
○○ Type name should define the existing XDTO object type or XDTO value
type.
○○ Property type should comply with the second rule of XDTO package check.
Property cannot contain an anonymous type definition.
If the Type property is not set, it should meet the following conditions:
○○ If the property has an anonymous type definition, the property type is the
type corresponding to this definition.
○○ Otherwise anyType of the XML schema namespace (http://www.
w3.org/2001/XMLSchema) is considered the property type.
If a default value is specified for the property, the following requirements
should be met:
○○ DefaultValue property type should be the XDTO property type.
○○ Lexical representation of the default value should match the space of values
for the XDTO property type.
The following requirements should be met:
○○ If the LocalName property of the XDTO property is not set, the Name
property of the XDTO property is used as the local name of the XML repre-
sentation for the XDTO property.
○○ If the NamespaceURI property of the XDTO property is not set, URI of
the XML namespace for XDTO property representation is determined as
follows:
□□ If the XML representation form of XDTO property (Form property)
is Item, it uses URI of the namespace for the type containing this
property.
□□ Otherwise URI of namespace for the XDTO property XML representation
is considered non-existent.
○○ XDTO property should be unique for the XML representation within the
XDTO object type.
○○ If the XDTO property has the Text XML representation form, the following
conditions should be met:
□□ Name and URI of the namespace should be undefined or empty.
□□ XDTO object type properties can include XDTO properties with the
Attribute XML representation form.
□□ If XDTO property has the Item XML representation form, it is not
allowed to use XDTO properties with the Text XML representation form
for this XDTO object type.
2-814 1C:Enterprise 8.3. Developer Guide
○○ Value of the lower boundary for the number of LowerBound property values
can be a non-negative integer. LowerBound value should be less than or
equal to the value of the upper boundary for the number of UpperBound
property values if it does not equal -1.
○○ UpperBound value can be a non-negative integer or -1. If it is -1, it means
the number of property values is unlimited.
○○ If the Fixed property value is set, DefaultValue must be set by default
and correspond to the XDTO property type value space.
○○ If a reference to the global property definition is set, the following require-
ments should be met:
□□ The property definition cannot override values of the global definition
properties.
□□ The global property referenced by the property definition should be
defined within the current package or its dependency packages.
If XDTO object type properties include an XDTO property with the same name
or XML representation as the base type property, the inheritance type is deter-
mined as limitation inheritance. The following conditions should be met for
this inheritance type:
○○ The following conditions should be met for each XDTO property:
□□ Base type should define the XDTO property with the same name – the
overridden property.
□□ If the base type determines the order of properties (Ordered property),
position of the overridden property should be identical to the position of
the property in the inheriting type.
□□ XML representation form of the overridden property and property of this
type should be the same.
□□ XML representation local name of the overridden property and property
of this type should be the same.
□□ XML representation namespace URI of the overridden property and
property of this type should be the same.
○○ If the overridden property determines a fixed value:
□□ The fixed value cannot be removed from the inheriting type.
□□ The fixed value in the base type and the inheriting type should be the
same.
□□ The lower limit for the number of property values should be less than or
equal to the lower limit for the number of overridden property values.
□□ The upper limit for the number of property values should be greater than
or equal to the upper limit for the number of overridden property values.
□□ The property type should be a descendant of the overridden property
type.
Chapter 16. XDTO Mechanism 2-815
□□ If the base type does not have mixed content (Mixed property), it is not
possible to set the mixed model for the inheriting type.
□□ If the base type has a fixed order of properties (Ordered property),
it is not possible to change the order in the inheriting type.
□□ If the base type does not specify a sequence (Sequenced property),
it is not possible to specify it in the inheriting type.
□□ If the base type does not have an open content model (Open property),
it is not possible to set the open content model for the inheriting type.
Otherwise (see rule 4) the inheriting type is determined as enhancement inherit-
ance. The following conditions should be met for this inheritance type:
If the base type content model is mixed (Mixed property), it is not possible to
change the mixed model in the inheriting type.
If the base type property order is not fixed (Ordered property), it is not
possible to change the order in the inheriting type.
If the base type specifies a sequence (Sequenced property), it is not possible
to disable the sequence in the inheriting type.
If the base type has an open content model (Open property), it is not possible
to change the content model for the inheriting type.
The following conditions should be met for any inheritance type:
If the content model is mixed (Mixed property), it is not possible to disable
sequences (Sequenced property).
If the content model is open (Open property), it is not possible to disable
sequences (Sequenced property).
○○ In the base type, Length facet values should not be set or the MaxLength
facet value should be the same as the effective value of the base type
MaxLength facet.
Rules for the MinLength facet:
Facet value should be greater than or equal to the effective facet value in the
base class.
Facet value should be less than or equal to the MaxLength facet effective value.
Rules for the MaxLength facet:
Facet value should be less than or equal to the effective facet value in the base
class.
Facet value should be greater than or equal to the MinLength facet effective
value.
Rules for the Whitespace facet:
If the base type facet effective value is Сollapse, the facet cannot have any
other value.
If the base type facet effective value is Preserve, the facet cannot have Replace
value.
Rules for the MinInclusive facet:
Facet value should be less than the MaxExclusive facet effective value of this
type.
Facet value should be greater than or equal to the base-type facet effective
value.
If MaxInclusive facet value is set, it should be less than or equal to the base
type MaxInclusive facet effective value.
If MinInclusive facet value is set, it should be greater than the base-type
MinInclusive facet effective value.
If MaxExclusive facet value is set, it should be less than the base-type
MaxExclusive facet effective value.
Rules for the MinExclusive facet:
It is not permitted to set the MinExclusive and MinInclusive facet values
in the type definition.
If the MaxInclusive facet value is set, the MinExclusive facet value should
be less than the MaxInclusive facet value for this type.
Facet value should be greater than or equal to the base-type facet effective
value.
If the MaxInclusive facet value is set, it should be less than or equal to the
base-type MaxInclusive facet effective value.
If the MinInclusive facet value is set, it should be greater than or equal to the
base-type MinInclusive facet effective value.
Chapter 16. XDTO Mechanism 2-817
If the MaxExclusive facet value is set, it should be less than the effective
MinInclusive base-type facet value.
Rules for the MaxInclusive facet:
Facet value should be greater than or equal to the MinInclusive facet value for
this type.
If the MaxExclusive facet value is set, it should be less than the effective
value for the base type.
If the MinInclusive facet value is set, it should be greater than or equal to the
effective value for the base type.
If the MinExclusive facet value is set, it should be greater than the effective
value for the base type.
Rules for the MaxExclusive facet:
It is not permitted to set the MaxExclusive and MaxInclusive facet values
in the type definition.
If the MinExclusive facet value is set, the MaxExclusive facet value should
be greater than the MinExclusive facet value for this type.
Facet value should be less than or equal to the effective base-type facet value.
If the MaxInclusive facet value is set, it should be less than or equal to the
effective value for the base type.
If the MinExclusive facet value is set, it should be greater than the effective
value for the base type.
If the MinInclusive facet value is set, it should be greater than the effective
value for the base type.
Rules for the DigitsTotal facet:
Facet value should be less than or equal to the effective base-type facet value.
Rules for the FractionPartDigits facet:
Facet value should be less than or equal to the effective DigitsTotal facet
value.
Facet value should be less than or equal to the effective base-type facet value.
2-818 1C:Enterprise 8.3. Developer Guide
Chapter 17
The Service Manager is executed in the procedure of the service host which
receives/sends messages from/to the Service Manager. An IIS or Apache Web
server can be used as the service host.
The Service Manager contains the pool of connections providing interaction with
1C:Enterprise databases.
The Web service mechanism that is implemented in 1C:Enterprise supports the
following standards:
SOAP 1.1
SOAP 1.2
WSDL 1.1
WS-I Basic Profile 1.1
HTTP 1.1
SSL 3.0/TLS 1.0
SessionParametersSetting event of the session module is called in the privi-
leged mode at the server. The invoked service module runs in the ordinary mode
at the server.
The session module (see page 1-172) is used for initialization of session param-
eters and execution of a certain set of commands when any 1C:Enterprise Web
service is called.
If DocumentRef.IsEmpty() Then
Return Undefined;
EndIf;
Document = DocumentRef.GetObject();
Chapter 17. Web Service Mechanism 2-823
Finally, publish the created Web service on the Web server, e.g.,
http://www.MyCompany.ru in the shipment catalog.
Static references have a higher operation speed because the description of the
supplier’s Web service is obtained once, on creation of the reference. When this Web
service is called at a later time, the existing description of the Web service is used.
With dynamic references, the description of the supplier’s Web service is obtained
by the 1C:Enterprise system every time this Web service is called, thereby slowing
down the operation of this Web service. However, the advantage of this approach
is that an up-to-date description of the supplier’s Web service is received. In order
to obtain a current description of the Web service when using static references, the
Designer has to import the WSDL description. The modified configuration then
has to be saved.
17.3.1. Example of Using Static Web Service References
A call to the Web service (WS) created in the example above (see page 2-821) can
be considered as an example of using third-party vendor Web services.
First of all, a new InvoiceData WS reference configuration object refer-
ring to the published service must be added to the configuration tree. For this
purpose, the WSDL description of the published service has to be imported, with
http://www.MyCompany.ru/shipment/ws/Shipment.1cws?wsdl specified as the URL.
For a description of WSDL description import see page 1-244.
Then the following procedure can be created, for example, in the receipt module.
It populates the tabular section of the document with the supplier’s invoice data
obtained through the supplier’s Web service.
Procedure GetInvoiceData(SupplierInvoiceNumber)
InvoiceData= Proxy.Get();
NewRow = DocumentObject.Content.Add();
NewRow.Count = InvLine.Count;
NewRow.Price = InvLine.Price;
NewRow.Sum = InvLine.Sum;
InvoiceData= Proxy.Get();
InvoiceData= Proxy.Get();
In transaction – indicates whether or not the code of the Web service module
is executed in the transaction. If the property is set, the transaction starts
automatically when the Web service is called and upon completion the transac-
tion is either submitted or rolled back (depending on the results of execution).
If the property is not set, the transaction is not started when Web service
module execution starts.
Method name – name of the Web service module export procedure that
is executed when this property is called.
JOB MECHANISM
It can be checked whether a job is executed for the specified date (ExecutionRe-
quired() method of JobSchedule object). Scheduled jobs are always performed
under a specific user account. If a scheduled job user is not specified, the job
is executed with the default role rights assigned for the configuration. If the default
role is not assigned for the configuration, the job is executed with no access rights
restriction.
Scheduled jobs are performed using background jobs. When the Scheduler deter-
mines that a scheduled job should be performed, it creates a background job
based on this scheduled job that performs the further processing. If the scheduled
job is already running, it is not launched again regardless of its schedule.
Scheduled jobs can be re-launched. It is particularly important when execution
of the scheduled job method needs to be guaranteed. A scheduled job needs to
be re-launched if it fails or if a working process (client/server mode) or client
process (file-mode version) used to execute the scheduled job fails. A scheduled
job can specify the number of times that job needs to be restarted (Restart count
on failure property), and an interval between restarts (Restart interval on failure).
When a scheduled number of restarts has been completed, start attempts stop until
the time for starting that scheduled job comes around once again (as per schedule).
Chapter 18. Job Mechanism 2-831
A restart counter resets, and in case of failure of a scheduled job, the restart
process starts again.
When implementing the re-launched scheduled job method, please bear in mind
that re-launching the job executes it from the beginning rather than the point of
failure.
Scheduled jobs are executed by a web server extension until it serves at least
one client session.
Scheduled jobs are processed once every 60 seconds.
Check the days of week when the job has to be executed. If it is necessary
to execute the job repeatedly, specify repetition interval in weeks. For example,
if a job is executed once in two weeks, repetition value is 2.
The Monthly tab contains job schedule for a month.
Check the months when the job has to be executed. If necessary, you can define
specific day of week or month for execution. You set it as a value from the begin-
ning or end of week or month.
Use – if it is set, the job is performed according to the schedule.
Predefined – if it is set, the job is predefined.
Restart count on failure – number of attempts to restart at abortion.
Repeat interval on failure – interval between attempts to restart at abortion.
Creation of Sample Background Job "Update Full Text Search Index":
BackgroundJobs.Execute("UpdateFullTextSearchIndex");
1C:Enterprise mechanism of full-text data search allows the user to search the data-
base using search operators (AND, OR, NOT, NEAR, etc.).
The full-text search mechanism is based on using two components:
full-text index created in the database and periodically updated as necessary;
full-text search tools.
Changes of full-text search objects are registered by 1C:Enterprise in a change log.
The log is written when objects are recorded in the database. Only objects set up
for full-text indexing are included in change files. If transaction rollback cancels
object recording to the database, entry in the change log remains unchanged.
Full-text indexing is performed in the privileged mode (in the server context)
and does not require exclusive lock of the database. During full-text indexing
change registration files are read and changed objects are obtained from the data-
base, words are transliterated and Latin letters in words are replaced by Cyrillic
characters (however, the index stores both forms of the word). Only the following
attribute types can be indexed:
string
date
number
reference types
value storage
The following items are added to the full-text index for each object and attribute:
name of metadata objects or its attribute
synonym of metadata objects or its attribute (in all configuration languages)
presentation of metadata object (in all configuration languages)
Standard and user attributes are indexed in all languages allowing to perform
searches in all configuration languages (e.g., in Russian and in English).
NOTE
The Cyrillic letter "ё" in all words is replaced by the Cyrillic letter "е" for full-
text indexing and search purposes.
For information about file location for the full-text search index see
"1C:Enterprise 8.3. Administrator Guide".
Full-text indexing generates the main index; subsequent database changes create an
additional index that contains information about data modified after the last update
of the main index.
Search in the main index is very efficient, while search in the additional index
takes more time. This is why the indexing process features an index merge
functionality that adds the last data change results to the main index. Please note,
however, that this operation might take a long time (if the main index if big);
therefore, it is recommended to run it when the load on the system is minimal (at
night time or week-ends).
Full-text search is user-initiated in the client application context and is executed
in the server context. It means search is performed at the client machine in the
file-mode version and at the 1C:Enterprise server cluster – in the client/server
mode.
Chapter 19. Full-Text Data Search Mechanism 2-837
Full-text data search is based on user rights (including access right restrictions at
the level of database records and fields). Search results can include misspelt words:
for example, if a word contains Cyrillic "ь" instead of Latin "m" or is spelt as
"systeь" instead of "system" due to indeliberate language change, these words are
also added to the search results.
Search results are returned in chunks of the size defined when executing the full-
text search command.
Results are ranked on the basis of the following priorities:
metadata object "weight": the more object attributes reference this object, the
bigger is its "weight";
date of the object (newer objects are displayed at the beginning).
all objects are found). It is recommended to analyze the value returned by this
method when receiving the last portion of found data in order to inform the user
that not all results have been received from the database.
The GetDescription property contains a flag used to get search results descrip-
tion. If it is set to True, the Description value is filled for each search result
providing context for found words. However, if this property is set to False,
search is performed faster.
Full-text search list is a collection of full-text search list items that can be tabbed
through using the operator For Each … From … Do.
Each full-text search list item is represented by FullTextSearchListItem object
and has the following properties:
Value – identifies data (object or set of records) containing the search expres-
sion;
Metadata – metadata object describing data containing the search expression;
Presentation – text presentation of found object;
Description – contains pairs <attribute>:<value> (beginning on a new
line) where:
○○ <attribute> is object attribute whose value contains the search expression;
○○ <value> is value of this attribute.
Using the GetRepresentation() method you can obtain search results as
XMLReader object or a string with HTML-text where found words are highlighted
by HTML means (bold font and background color).
Dictionary Item
It is used to store dictionary. A dictionary can have two sections:
additional words (lemmas) and their forms
sets of synonyms
Words Item
It contains words in the following format:
lemma item stores the main form of the word (nominative case);
forms item contains other case-forms of the word.
Fuzzy search is not used by default. To run a fuzzy search use the * operator.
Example: searching for mous* finds mouse, mouse and mice.
Synonyms Item
It stores sets of synonyms. Each set is enclosed in item tags.
To include synonyms in full-text search, use the ! operator. Searching for !error
finds error, bug and failure. For a description of search expression syntax see
page 2-1207.
Synonyms and Words items can be ordered randomly.
The system loads dictionaries when search is first called or indexing
is performed. If errors are found in the template, filling dictionaries is stopped
at the error position.
If the dictionary has been modified, re-start the client for the system to use the
updated dictionary. However, index is not auto-updated and has to be rebuilt
manually, although searches use new dictionaries.
Chapter 20
TEMPORARY STORAGE
MECHANISM, WORKING
WITH FILES AND PICTURES
1C:Enterprise features a temporary storage mechanism that can store data bound
to sessions. Another mechanism is used to work with files; it supports file
exchange between the infobase and client application. This mechanism is specifi-
cally designed for thin and web clients and accounts for Web browser-specific
constraints applied to working with files.
The temporary storage mechanism combined with the file use mechanism provides
a set that can be used to place locally stored data to the infobase temporary
storage, transfer this information from the temporary storage to the database and
retrieve it to the user machine. The most common application tasks solved by
these mechanisms are storing extra information, such as product pictures, contract-
related documents, etc. Temporary storage and file use mechanisms are often used
together, though they can also be used individually.
Temporary storage can be used as a universal storage with controlled data lifetime:
If data placed in the temporary storage are bound to a form, their lifetime
depends on the form lifetime. When the form object is removed, the storage
is cleared of all related information.
If data placed in the temporary storage are not bound to a form, the storage
is cleared in the following cases:
○○ the next form request;
○○ the next server call from client common module;
○○ context and out-of-context client calls from the form;
○○ server call from command module. If the server is called to place a value
in the temporary storage, clearing is not performed. The storage is cleared
after the call has completed.
It means one or more values can be placed in the temporary storage and used
in the next call. After the value is used, but before the server call has completed,
the value is automatically deleted.
The most typical application task solved by temporary storage is providing access
to files or pictures before object is recorded in the infobase, e.g., in an item form.
Data placed in the storage are identified by a unique address that can later be used
in write, read or delete operations. This address is returned by methods that write
values to the temporary storage. A separate method of the 1C:Enterprise script
can be used to determine if the passed address points to the data in the temporary
storage.
NOTE
To use the PutFiles() method enable an extension for working with files in the
web client (see page 2-851).
NOTE
When you retrieve values from a temporary storage to the server, note that
they are obtained via references. In fact, this reference points to a value stored
in cache. The value will be stored in cache and then written to disc and removed
from cache within 20 minutes of it being placed in the storage or after it is last
called. The next time you call the value, it will be downloaded from disc and put
into cache again.
parameter specifies where the file is to be saved. A path is required in the non-in-
teractive mode. This parameter is optional in the interactive mode.
By default this method runs in the interactive mode. In other words, it generates
a dialog box where the user selects an action for the retrieved file: execute it or
save in the user-selected file system location. If the interactive mode is selected,
but File Name parameter is not specified, the open file operation is unavailable.
This method returns a Boolean value. False means the user has cancelled the
operation in the save file dialog box in the interactive mode.
Upon completion this method can return a list of downloaded files with their full
names.
NOTE
To use the GetFiles() method enable an extension for working with files in the
web client (see page 2-851).
If the Name property of the TransferableFileDescription object contains
an absolute path to a file, the file is saved in this path with no regard to the
FileLocation parameter.
2-846 1C:Enterprise 8.3. Developer Guide
The local file system path or a FileDialog object can be used as the
FileLocation parameter in directory selection mode or file selection mode.
If a FileDialog object is set as the FileLocation parameter in file save mode:
The dialog will be called for every sent file, except files for which the Name prop-
erty of the TransferableFileDescription object contains an absolute path.
The value of the Name property of the TransferableFileDescription object
will be used as the initial file name in the dialog.
If saving is cancelled for any file, the Name property of the Transferab-
leFileDescription object will contain an empty string.
The GetFiles() method returns True if at least one file is successfully
received.
Note that files are actually received after the user responds to prompts to specify
the name and path of all received files.
If the user on behalf of whom the GetFiles()method is executed lacks
View rights to at least one object attribute of an infobase from which files are
received, the entire operation fails.
Example:
TranserredFiles = New Array;
Details = New TransferableFileDescription("Details", AddressFile);
TranserredFiles.Add(Details);
If interactive mode is selected for file directory selection, the web client also
prompts the user to confirm that files with absolute paths are to be saved. If files are
saved non-interactively (directory path is specified in the appropriate parameter),
the query is executed for the entire list of files to be saved.
Var SelectedName;
Var TempStorageURL;
NewObject = Object.Ref.IsEmpty();
Chapter 20. Temporary Storage Mechanism, Working with Files and Pictures 2-847
Object.FileName = SelectedName;
PutObjectFile(TempStorageURL);
EndIf;
EndProcedure
CatalogItem = FormAttributeToValue("Object");
BinaryData = GetFromTempStorage(TempStorageURL);
CatalogItem.FileData = New ValueStorage(BinaryData, New Deflation());
Modified = False;
DeleteFromTempStorage(TempStorageURL);
ValueToFormAttribute(CatalogItem, "Object");
EndProcedure
Address =GetURL(Object.Ref,"FileData");
GetFile(Address, Object.FileName, True);
EndProcedure
additional user prompts. If the permission is denied, operations will be executed
normally: one prompt per request.
NOTE
To use the RequestUserPermission() method in the web client, you need to
connect the files operations extension (see page 2-851).
Let's take a look at an example of the code:
If AttachFileSystemExtension() Then
Ref = GetURL(Object.Ref, "FileData");
// Generate description of the passed files (in this case one file)
UploadingFiles = New Array;
Details = New TransferableFileDescription(Object.FileName, Ref);
UploadingFiles.Add(Details);
// Prepare object for receiving information about received files
UploadedFiles = New Array;
// Define other parameters of methods
StorageDirectory = "c:\temp";
Interactively = False;
UploadedFileName = StorageDirectory + "\" + Object.FileName;
// Prepare description of methods for receipt of permissions
Methods = New Array;
Methods.Add(New Array);
Methods[0].Add("GetFiles");
Methods[0].Add(UploadingFiles);
Methods[0].Add(UploadedFiles);
Methods[0].Add(StorageDirectory);
Methods[0].Add(Interactively);
Methods.Add(New Array);
Methods[1].Add("RunApp");
Methods[1].Add(UploadedFileName);
If Not RequestUserPermission(Methods) Then
EndIf;
GetFiles(UploadingFiles, UploadedFiles, StorageDirectory, Interactively);
RunApp(UploadedFileName);
Else
DoMessageBox("The operation is not supported. The File Operations extension is not installed.");
EndIf;
Chapter 20. Temporary Storage Mechanism, Working with Files and Pictures 2-849
For this purpose the Data property of the form element should be assigned a string-
type attribute. The value of this attribute is interpreted as picture address.
// Example 1
// Bind picture box to picture address in temporary
// storage. PictureAddress – string-type form attribute
PutFile(PictureAddress, SourceName, SelectedName, True, UUID);
// Example 2
// Get picture address from attribute of
// infobase object
PictureFile = Object.PictureFile;
If Not PictureFile.IsEmpty() Then
PictureAddress = GetURL(PictureFile, "FileData")
Else
PictureAddress = "";
EndIf;
Chapter 20. Temporary Storage Mechanism, Working with Files and Pictures 2-851
○○ CreateDirectory()
○○ FileCopy()
○○ MoveFile()
○○ DeleteFiles()
Objects:
○○ File
○○ FileDialog
NOTE 1
For the file operations extension to work correctly, it is recommended to use
Microsoft Core XML Services (MSXML) version 4.0 or 6.0 in Microsoft Internet
Explorer.
NOTE 2
The file operations extension for Microsoft Internet Explorer is installed
in %APPDATA%\1C\1СEWebExt\FileSystemExtIE.
Do the following before using these components:
Customize the web browser as necessary (for details see "1C:Enterprise 8.3.
Administrator Guide").
Install the extension for working with files. Use the global context
InstallFileSystemExtension() method for this purpose. This activity
is interactive and has to be executed once for each local machine user working
with the extension.
Enable the extension for working with files. Use the AttachFileSystemEx-
tension() method for this purpose.
Chapter 21
Administrative tasks often require you to find out what events have occurred at
a particular time or what actions various users have executed.
The event log is used for this purpose. Various events are recorded in this log. An
administrator can use it to obtain a history of users' interactions with the system.
The event log is not stored in the database and is not saved when an infobase
is restored/dumped.
When users work in 1С:Enterprise, the software registers major user actions
involving infobase data modifications, data access granting/denying scheduled
operations, connection and disconnection, etc.
Besides interactive tools to work with the log provided in the designer, you can
also work with the log programmatically.
This chapter describes the software tools available for working with the event log.
SetEventLogUsing(Levels);
2-854 1C:Enterprise 8.3. Developer Guide
SetEventLogEventUse("_$PerformError$_", EventUse);
Note that there are two events that have additional abilities for event logging
configuration. These are the Access (_$Access$_.Access) and Access denied
(_$Access$_.AccessDenied) events. Let's discuss these events in more detail.
NOTE
Transaction related events (_$Transaction$_.Begin, _$Transaction$_.Com-
mit, _$Transaction$_.Rollback) cannot be disabled via SetEventLogEven-
tUse method.
The amount of data written to the event log depends on the event logging configu-
ration:
Use Access fields Logging fields Result
Not set Event is not logged
Set Not set Not set Event is not logged
Set Set Not set Event is logged without details
Set Set Set Event is logged with the logging fields specified
is LastName in the example). If only one field of the two is used in the
request, this field goes to the event log.
Let's look at another example of Access event configuration:
SetupInformationRegister = New EventLogAccessEventUseDescription();
SetupMetadataObjects.Add(SetupInformationRegister);
If access to data are violated in a Reading operation, the Access denied event will
be logged and the logging field will be written according to the rules for Access
event logging fields. For other actions (Change, Delete, Add) an event is trig-
gered, but no data are written.
The value of a structure item passed in the Filter parameter can be a specific
value, Structure or Array. Event log data are checked for consistence with filter
parameters as follows:
If a specific value is passed, record data and filter values are compared.
If a value array is passed, event log record data values and all values of the
array passed as the filter value are compared. The condition is considered
fulfilled if the value set in the log record matches at least one value in the
passed array.
If a structure is passed as the value, the condition is considered fulfilled if
event log record data are matched for all items of the passed structure.
Let's discuss it in more detail.
1. If the Data field of the event log record contains a structure, the filter Data
field also contains a structure. In this case the record satisfies the condition if
the log Data field includes all keys from the filter field with the same name and
the values of these keys match.
2. If the Data field of the event log record contains a value table, the filter Data
field contains a structure. In this case the record satisfies the condition if the
value table contains all the columns with names equal to filter structure key
names and rows where the corresponding column values match filter structure
values.
3. If the Data field of the event log record contains a Structure, Array or
ValueTable type of value, the filter Data field contains an array. In this case
the record satisfies the condition if at least one value from the passed array
is found in the log record data.
4. If the Data field of the event log record contains any value (not a structure,
array or a value table), the filter Data field contains an array. In this case the
record satisfies the condition if the log record value is equal to any value from
the passed array.
5. The log record Data field contains a ValueTable-type value item, the filter
Data field contains an Array-type item and item keys match. In this case the
record satisfies the condition if at least one table cell is equal to any value from
the passed array.
6. If the Data field of the event log record contains a Structure, Array or
ValueTable type of value, the filter Data field contains the Structure or
Array type. The log record will satisfy the condition if a record in the nested
data fulfills p. 1 and p. 5 conditions. But if a structure is set in the filter,
a search for items in the structure or event log value table columns corre-
sponding to structure items will be performed only for a specified nesting level
that corresponds to the filter nesting level. Thus, separate values and values
from arrays in the filter are searched in full depth, and filter structure items are
searched only at the specified level.
2-860 1C:Enterprise 8.3. Developer Guide
When a value table in the event log Data field is generated and it contains
columns with the same name, these columns are merged into a single column.
The number of rows in this table is increased, so the result column includes all
unique values from the columns with the same name. Values in other columns are
duplicated in rows generated.
Let’s illustrate this using an example. Suppose an application contains a query that
returns a table with the following columns:
CatalogRef.Products
CatalogRef.Products
Row
When an event log record is generated, the following transformation is performed:
The first two columns will be merged into a single column.
For every row where Products.Reference and Nomenclature.Reference
values are not equal, another row will be generated.
Rows will have a different value of the merged column with reference values.
Other column values will be the same.
Source table:
Reference Reference Article
Sausages Pepper 16-АВ-1675
Result table:
Reference Article
Sausages 16-АВ-1675
Pepper 16-АВ-1675
Let's show some examples showing how filters work when event log records are
received.
Example 1:
Event log Data field value for the Authentication event:
○○ type: Structure
□□ key: OSUser, value: Johnson
Filter Data field value of the UnloadEventLog() method:
○○ type: Structure
□□ key: OSUser, value: Johnson
Result: record matches
Example 2:
Event log Data field value for the Access event:
○○ type: Structure
□□ key: Data, value: ValueTable
Chapter 21. The Event Log 2-861
THE CRYPTOGRAPHIC
MECHANISM
When 1C:Enterprise is used in automation systems, you might need to check that
a document stored in the system wasn't modified (for example, a document with
a text of the agreement is attached to the Agreement database object). There
also could be a need to transfer some signed information or implement approval
of a document within the system. Some scenarios are possible when you need to
transfer information via public channels so that it would be impossible to read the
information if it is intercepted (data encryption).
For that purpose, 1C:Enterprise implements a cryptographic mechanism based on
asymmetric encryption (a couple of keys are used, public and private).
IMPORTANT!
The 1C:Enterprise cryptographic mechanism does not actually implement crypto-
graphic algorithms. It provides a set of objects that can be used to communicate
with third parties’ external cryptographic modules.
A certificate is a public key signed by a certificate authority. Since a private key
should be protected, it exists in a container. Key container can include an open
key in addition to a private key (e.g., as a certificate).
Cryptographic extension should be installed for the web client to work. The web
client specifies that the user permission query is executed for some operations (file
system access and private key access).
This example creates a module to work with Russian cryptographic modules (the
CryptographicModuleType parameter value is 75).
Return CertificateList;
EndFunction
&AtClient
Procedure ObtainCertificateList()
StorageTypes = New Array;
StorageTypes.Add(CryptoCertificateStoreType.PersonalCertificates);
StorageTypes.Add(CryptoCertificateStoreType.RecipientCertificates);
List = GetCertificateList(75, StorageTypes, True);
// ...
EndProcedure
File encryption
A file selected interactively is encrypted and then written to a disk of a client
computer.
For demonstration, encryption operation always uses the first certificate in the list
of all of certificates installed on the computer.
&AtServer
Function EncryptAtServer(DataAddress, CertificatesData)
// Create certificates on the basis of binary data certificates // from the client
Certificates = New Array();
For Each CertificateData In CertificatesData Do
Certificates.Add(New CryptoCertificate(CertificateData));
EndDo;
CryptoManager = New CryptoManager("", "", 75);
// Get file for encryption from the temporary storage
Data = GetFromTempStorage(DataAddress);
If TypeOf(Data) <> Type("BinaryData") Then
Return False;
EndIf;
// Encrypt binary data
EncryptedBinaryData = CryptoManager.Encrypt(Data, Certificates);
Return True;
EndFunction
2-868 1C:Enterprise 8.3. Developer Guide
&AtClient
Procedure FileEncryption()
Address = "";
Result = PutFile(Address, , , True);
If Not Result Then
Return;
EndIf;
CertificateTypes = New Array;
CertificateTypes.Add(CryptoCertificateStoreType.PersonalCertificates);
List = GetCertificateList(75, CertificateTypes, True);
// In this example we always encrypt using the first by order certificate
Certificates = New Array;
Certificates.Add(List[0].Unload());
// Encrypt file
Result = EncryptAtServer(Address, Certificates);
If Not Result Then
Return;
EndIf;
// Interactively save encrypted file to disk
GetFile(Address, , True);
EndProcedure
File decryption
An attempt to decrypt the selected file is executed. It is necessary to implement
the GetAccessPassword() function that returns the password to access the
private key.
NOTE
When the Decrypt() method is used, an exception is called only when decryp-
tion attempts using all available certificates have failed, not just after the first
error.
&AtClient
Procedure FileDecryption()
// Choose encrypted file
Address = "";
Result = PutFile(Address, , , True);
If Not Result Then
Return;
EndIf;
Data = GetFromTempStorage(Address);
Chapter 22. The Cryptographic Mechanism 2-869
// Decrypt file
CryptoManager = New CryptoManager("", "", 75);
CryptoManager.PrivateKeyAccessPassword = GetAccessPassword();
DecryptedData = CryptoManager.Decrypt(Data);
Address = PutToTempStorage(DecryptedData);
GetFile(Address, , True);
EndProcedure
&AtClient
Procedure SignFile()
Address = "";
Result = PutFile(Address, , , True);
If Not Result Then
Return;
EndIf;
CertificateTypes = New Array;
CertificateTypes.Add(CryptoCertificateStoreType.PersonalCertificates);
List = GetCertificateList(75, CertificateTypes, True);
Certificate = List[0];
Data = GetFromTempStorage(Address);
CryptoManager = New CryptoManager("", "", 75);
CryptoManager.PrivateKeyAccessPassword = GetAccessPassword();
CryptoManager.Sign(Data, "signature.sign", Certificate);
EndProcedure
Certificate = Undefined;
CryptoManager = New CryptoManager("", "", 75);
2-870 1C:Enterprise 8.3. Developer Guide
Try
Except
Return False;
EndTry
Return True;
EndFunction
Chapter 23
When an infobase based on 1C:Enterprise is used, you may want to get infor-
mation from external data bases (both relational and analytical) and use this
information in 1C:Enterprise in a number of ways (for reports, calculations etc).
An ExternalDataSources configuration object is used to solve these tasks
in 1C:Enterprise. An external data source may include tables from a relational
data source and cubes from an analytical data source. An application may contain
any number of connected external data sources. Below, we take a closer look at
working with all types of external data sources.
an external data source table can be included in subsystems (see page 1-173);
an external data source table can be included in functional options (page
1-211);
characteristics can be created for an external data source table (see page 1-309).
The ODBC engine is used to get access to external data sources. Data from
external data sources are read only.
IMPORTANT!
The external data source mechanism should not be used to access 1C:Enterprise
databases, since the 1C:Enterprise data model is not designed to work with data
at DBMS storage physical structure level.
1C:Enterprise abilities are thoroughly considered when the following DBMS
systems are used as an external data source:
Microsoft SQL Server
IBM DB2
PostgreSQL
Oracle Database
NOTE
When working with an external data source, errors may occur if the Database
management system type property of the external data source connection param-
eters contain a value that does not match the system that is actually used.
When other DBMS are used, external data source functions depend on a specific
DBMS. The following query language expressions and functions for such data
sources are transformed into a DBMS query with the help of ODBC Escape
Sequences (http://msdn.microsoft.com/en-us/library/windows/desktop/ms715364(v=vs.85).aspx):
SUBSTRING, YEAR, QUARTER, MONTH, DAYOFYEAR, DAY, WEEK, WEEKDAY, HOUR,
MINUTE, SECOND, DATEDIFF, ISNULL, CAST, ESCAPE, JOIN, LEFT JOIN, RIGHT
JOIN, and FULL JOIN.
To connect to an external data source you need to generate a connection string that
can contain either all the connection parameters required for the selected ODBC
driver or a reference to a generated DSN (Data Source Name) data source descrip-
tion. For more about connection string see page 2-879.
String connection examples are provided below.
String connection with a login and a password:
DRIVER={SQL Server};SERVER=(local);UID=user;PWD=password;DATABASE=AdventureWorksLT2008
Also, you should remember that connection to an external data source should be
specified in both the Designer (if the table structure is imported for the external
data source) as well as 1C:Enterprise mode to receive data.
The system performs the following actions when you obtain data source structure:
An attempt to determine the data table type (object or non-object) is performed.
The table is considered to be an object if only one key field is specified;
otherwise it is considered to be a non-object. If the system made a mistake
in specifying the key fields, you can manually change the fields that form the
Chapter 23. External Data Sources 2-877
table key. If the table is defined as an object table, you can specify a field for
representing the data of such type. The representation field should be specified
manually.
Data source column types are converted to 1C:Enterprise types that will be used
to specify table attribute types. All external data source types are converted
into the following 1C:Enterprise types: Number, String, Data, Boolean, UUID,
Binary Data and types related to data source object tables.
An attempt to determine table field types is performed. In this case the system
tries to determine which data type is stored in the table column; if it can be
considered as a reference to other table data, the system specifies a corre-
sponding type in the column. If the system selected the wrong table column
type, this can be changed manually.
Then you should check tables and fields that will be migrated to application meta-
data.
If the Remove tables and fields not present in external data source from configura-
tion checkbox is selected, when the table designer work is done fields and tables
that do not exist in the external source will be deleted from the configuration (for
example, if fields or tables were deleted from the external source).
When the Finish button is clicked, external data source structure is loaded.
Let's create necessary configuration objects to get access to all data in these
tables.
First, we will create the data source itself. We'll name it DBF. The next step is to
create data source tables manually. Note that the real name of a data source phys-
ical table is specified in the Name in data source property of the created object.
We will name the configuration object as follows when tables are created:
the products table will be displayed in the Products object.
the price table will be displayed in the Prices object.
the sales table will be displayed in the Sales object.
Now we need to create fields for each table, specify the field types and assign key
fields and representation fields (if any).
The example will have one object table (the Products table). Other tables will be
non-object. You can see the physical table fields and configuration object fields
matching and field types in fig. 317.
Then you should specify the subsystem that contains the tables created and other
configuration object parameters (if necessary).
If you start the system in 1C:Enterprise mode and correctly specify the external
data source connection parameters, the tables created will be shown in the naviga-
tion panel:
from the Connection to Data Source will be used, as they will be added to the
connection string on the right.
Use http://www.connectionstrings.com/ for reference and help with simplifying creation
of a connection string.
A close (but not similar!) analogue of storing data in OLAP systems is an accumu-
lation register, where the register is similar to a cube, measure of the CatalogRef
type is similar to a cube’s measure, and the catalog contains measure members
and register resources are similar to cube measurements.1C:Enterprise presents the
OLAP system cubes as a model, where:
A cube is represented by the cube in configuration.
Dimensions and dimension members are represented as two objects:
○○ Measures are analogues of measures.
○○ Measures tables are used to describe measure member collections.
Measures are presented as resources.
Therefore, an external source that connects to the OLAP system includes cubes,
and each cube consists of a table of dimensions, the dimensions themselves, and
resources. Tables of measures consist of fields. Cube resources may be numerical
or string.
The object that describes an external data source may be used as follows:
as a data source for queries.
as a data source in the data composition system.
as a source for dynamic lists.
as a member of common attributes (see page 1-204).
records of measurement tables and cubes may be displayed in managed forms
of 1C:Enterprise (using standard forms for external data source objects is not
supported).
the measurement tables of an external data source may serve as infobase
attribute types.
access rights may be applied to cubes, measurement tables, measurement table
fields, measurements and resources of external data sources.
the script supports access to cubes, measurement tables, measurement table
fields, measurements, and resources.
the cubes and measurement tables of an external data source may be part of
subsystems (see page 1-173).
the cubes, measurement tables and measurements of an external data source
may be part of functional options (see page 1-211).
characteristics may be created for external data source cubes (see page 1-309).
The analytical XML mechanism (XML for Analysis, XMLA) is used to work with
multidimensional external data sources. The platform receives access to data with
the help of http requests to a web server that can be an external system (in rela-
tion to OLAP system) or integrated in an OLAP server. For further information on
customizing access to OLAP server data, see the documentation for that system.
A line to connect to an analytical external data source is a combination of an XMLA
provider URL address (for this OLAP system) and the parameters used by 1C:Enterprise
to work with the source. Data from external data sources is only read-only.
2-882 1C:Enterprise 8.3. Developer Guide
The capabilities of 1C:Enterprise are taken into account when the following OLAP
systems are used as an external data source (Database management system type
property of data source connection parameters):
IBM Infosphere Warehouse
Microsoft SQL Server Analysis Services
Oracle Essbase
NOTE
When working with an external data source, errors may occur if the Database
management system type property of the external data source connection param-
eters contain a value that does not match the system that is actually used.
When other DBMSs are used, the external data source capabilities depend on the
DBMS itself. To connect to an external data source, create a connection string.
For further details on connection strings, see page 2-883.
Moreover, an external data source connection should be specified in Designer
(if a mechanism to import a table structure from an external data source is used)
and in 1C:Enterprise mode to obtain the data itself.
Documentation on OLAP systems:
IBM Infosphere Warehouse:
○○ http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.dwe.navigate.doc/
welcome_db2warehouse.html
Microsoft SQL Server Analysis Services:
○○ Version 2008: http://technet.microsoft.com/en-us/library/bb522607(v=sql.100).aspx
○○ Version 2008 R2: http://technet.microsoft.com/en-us /library/bb522607(v=sql.105).
aspx
○○ Version 2012: http://technet.microsoft.com/en-us /library/bb522607(v=sql.110).aspx
Oracle Essbase:
○○ http://docs.oracle.com/cd/E17236_01/nav/portal_3.htm
23.2.2. The general principles of usage
To use information from external data sources in a 1C:Enterprise based system,
follow the general principles described below:
Examine the structure of an external data source and work out what informa-
tion (cubes, measurement tables, measurements, and resources) is necessary to
support 1C:Enterprise algorithms and reports.
Create an External data source object in Designer, and create the required
structure for this object. A special assistant can be used to do this.
Implement the use of objects created in the application.
Set up the external data source connection parameters in the network where the
application will be used. These parameters may differ from those used when
downloading an external data source structure.
Chapter 23. External Data Sources 2-883
NOTE
In 1C:Enterprise mode the system will not use external data source access param-
eters set in Designer.
23.2.3.5. Dimensions
An external data source dimension describes the OLAP system cube dimension.
Only a reference to a corresponding dimension table may be considered as such
a dimension type. In reality, dimension tables and the dimensions themselves
form a 1:1 correspondence: one dimension is described by one dimension table.
Uniting data from several external data source dimension in one field is not
supported.
23.2.3.6. Resources
An external data source resource describes the fact that there is an OLAP system
cube. The cube’s resource may be numerical or string. Resource values are calcu-
lated on the basis of cube dimension values. The Name in the data source property
should match the name of a fact (a resource) of the external data source cube.
Uniting data from several facts (resources) of an external data source in one data
resource is not supported.
can be considered a reference to data from another dimension table, the system
specifies the corresponding type in the column. If the system has selected an
incorrect table column type, it can be changed manually.
Where:
– – the value specified is not supported when working with a corresponding
OLAP system;
Yes – the value specified is supported when working with a corresponding
OLAP system;
Where:
OLAP host address, port, source – the OLAP system access address created by
the rules that are described in the OLAP system documentation.
parameters – parameters used by 1C:Enterprise to access OLAP system data.
Parameters are set as Parameter=Value. Parameters are separated by the &
character. The following parameters are used:
○○ ProviderName – service name of XMLA OLAP source.
○○ DataSourceName – name of the OLAP source.
○○ Catalog – catalog (or database) name of the OLAP source.
Sample connection strings are shown below:
For Microsoft SQL Server Analysis Services:
http://localhost:80/msolap/msmdpump.dll?ProviderName=Microsoft Analysis Services& DataSourceName=
host&Catalog=Adventure Works DW
2-888 1C:Enterprise 8.3. Developer Guide
This form lists all external data sources created in the Designer and available to the
user opened this form.
The Connected column specifies the external data source connection status in the
current session.
The Administration menu can be used to specify general connection options (the
Change common parameters command) and specific user connection options, if
they are different from the general options (Change user parameters).
The checkbox in the left side of the form (before the option names) means that this
option is used in this set of connection parameters. Options are analyzed in the
following order:
Options set for the session using the SetSessionConnectionOptions()
method of the external data source manager.
Options set for the user in an interactive configuration or using the
SetUserConnectionOptions() method of the external data source manager.
General options set interactively or using the SetGeneralConnectionOp-
tions() method of the external data source manager.
The resulting set of options will be used to connect to the external data source.
If some option is specified in multiple settings, the first value from the list given
above will be used.
For example, you can combine connection options as follows:
The user and user password are specified in session connection options.
The connection string with an external data source base is specified in the
general parameters.
Another connection string is specified as a specific user parameter that can be
used to test the application.
When you are specifying a connection string you should remember that access to
external data are implemented not from the computer where configuration takes
place, but from another computer (see the description on page 2-890).
If you click the Connect button, a dialog opens where you can set (or refine) the
connection options for the selected external data source.
The necessity of specifying a user name and password in this dialog depends on
the ODBC driver and connection string content. There are situations when a login
and password are not needed. If the user is not an administrator of the external
data source, the Change general options and Change custom options buttons are
not available.
The Use operating system authentication check box is available only if the user has
the SessionOSAuthenticationChange right.
2-890 1C:Enterprise 8.3. Developer Guide
When the Connect button is clicked, the external data source is connected. If the
connection is successful, content of the Connected column of the external data
source list is changed.
If the Disconnect button is clicked, 1C:Enterprise is disconnected from the
selected external data source.
23.5.2.1. In queries
To external analitycal sources
External data source tables can act as query sources. In this case an external data
source table is described as follows:
ExternalDataSource.<Source name>.Table.<Table name>
Example:
SELECT
Products.Code,
Products.Description,
Products.SKU
FROM
ExternalDataSource.DBF.Table.Products AS Products
This example selects the Code, Name and Article fields from the Products table
of the DBF external data source.
Temporary tables can be used in queries to an external data source. In this case
the system attempts to create a temporary table directly in the database connected
with the external database. An exception is called when the database management
system does not support the creation of external data sources. When called, the
name of the temporary table is generated as follows:
ExternalDataSource.<External data source name>.TemporaryTable.<Temporary table name>
Example:
SELECT Name, ProductID
INTO ExternalDataSource.AdventureWorks.TemporaryTable.Balance
FROM &ValueTable
For example:
SELECT FIRST 10
AdventureWorks.InternetSalesAmount
FROM
ExternalDataSource.OLAP.Cube.AdventureWorks AS AdventureWorks
In this example, the first ten InternetSalesAmount resources from the cube
AdventureWorks of the OLAP external data source are received
CAUTION!
We recommend you do not obtain all records from an external data source cube.
The number of entries is very large and may cause the system to overload.
A cube dimension table of an external data source may be described as follows:
ExternalDataSource.<Source name>.Cube.<Cube name>.DimensionTable.<Dimension table name>
Example:
CHOOSE
AdventureWorksMeasurementTableProduct.Ref
FROM
ExternalDataSource.OLAP.Cube.AdventureWorks.DimensionTable.Product AS AdventureWorksDimensionTableProduct
If external data sources are used in queries, remember of the following limitations:
Only one data source may be used in a query. The simultaneous use of an
external data source and, for example, 1C:Enterprise infobase data, is not
supported.
Chapter 23. External Data Sources 2-893
BinaryData type:
○○ All types are converted to binary data.
Date type:
○○ The date value is converted to a Date-type value.
○○ An exception is raised for all other data types.
The data separation mechanism is a special mechanism that is used to divide all
stored data and application workflow in different parts.
24.1. OVERVIEW
If the Data split property of a common attribute is set to Split, the data separation
mode is enabled and:
Configuration objects behavior is changed for configuration objects included
in the common attribute (hereinafter referred to as a separator).
The current separator value and its usage flag are determined for every separator
in the infobase.
Configuration objects included in such common attributes are called separated
configuration objects.
A configuration with such common attributes is considered a shared configu-
ration.
An infobase with a separated configuration is called a separated infobase.
Infobase data available for selected separator values and data of configuration
objects not separated are called a data area.
In all database record reading operations 1C:Enterprise automatically selects only
those records used whose separator values match the current separator values.
When data are written, the platform checks that the recorded data contain values
of the used separators equal to current separator values or equal to default values of
the corresponding types. If it is not, an exception is called.
2-896 1C:Enterprise 8.3. Developer Guide
Example:
// Initially object is recorded with the value of the separator
// Subscriber = 1
Object = ObjectRef.GetObject();
If recorded data contain separator values equal to default values of the corre-
sponding types, current session separator values will be written in object
separators. For separators not used in the current session:
When data are read, a filter is not used for these separators.
When data are modified, the values in recorded data are used.
A separator can include the following configuration objects:
Constants
Catalogs
Documents
Sequences
Document journals
Charts of characteristic types
Charts of accounts
Charts of calculation types
Business processes
Tasks
Information registers
Accumulation registers
Accounting registers
Calculation registers
Exchange plans
Scheduled jobs
infobase users (see page 2-899)
Note that sequences and document journals are separated objects only if they
include separated configuration objects. Contents of object separators included
in a sequence or a document journal should be identical.
A separator in the Independent and Shared mode can be used in data access
restrictions (see page 1-188).
Separator type can't be composite.
Chapter 24. The Data Separation Mechanism 2-897
If a common attribute acts as a separator, it has some additional properties that
affect system behaviour, and the behavior of configuration objects included in the
separator also changes. These properties are described in greater detail in the
following sections.
IMPORTANT!
You cannot change infobase regional settings when working with Microsoft SQL
Server if a String-type separator is being used.
IMPORTANT!
Data separation in Microsoft SQL Server 2000, IBM DB2 9.1 and other versions
of IBM DB2 is not supported if case-sensitive comparison of strings is set in the
database management system (if the COLLATION_SEQUENCE parameter value
is not UCA500R1_LROOT_AN_CX_EX_FX_HX_NX_S2).
restrictions. When separated data are written, the system automatically popu-
lates the common attribute with values set in the current session.
This mode can be used when an application uses the data of only one data area.
IMPORTANT!
In this mode database object references can be identical for objects written
in different data areas.
Independent and Shared – enables working with separated objects regardless
of separator usage in the session. In this mode only the data area determined
by the values of used separators will be available. In this case the separator
is available in the object model, the query language, XML and XDTO export
formats and data access restrictions. In this mode you can't create predefined
items for objects included in such separators. If all of the separators in which
the object is included are not used in the session, working with this object will
be less efficient.
This mode can be used in cases when an application in most situations works
only with data from one data area (e.g., when documents are entered), and
in some modes it can use the data of multiple or all areas, for example, to get
consolidated reports.
IMPORTANT!
In this mode database object references can't be identical for different objects
written in different data areas.
When editing a user, you can specify values for all separators specified in the
configuration, not only those that have the User split property set to Split. Separator
values specified in infobase user properties will be used to set separator values
at the start of the current user session. Separator values in a command line or
a connection string have a higher priority than the values specified in user proper-
ties, if the user is authorized to change the corresponding session parameters.
2-900 1C:Enterprise 8.3. Developer Guide
If the Authentication split property of this separator is set to Do not use, you can't
create this list. User names should be unique, for example:
User name Subscriber separator value
Administrator Not set
Administrator1634 1634
Administrator2245 2245
Administrator1245 1245
If the separator is conditionally disabled, the default value of this separator type
will be used as the separator value.
NOTE
For every separator, the conditional separation value can't directly or indirectly
depend on the value of the separator.
Recursive conditional separation management is possible when conditional separa-
tion is configured for a separator used to determine the conditional separation of
another separator. In this case determination of the conditional separation state will
start with a separator, the value of which is not conditionally separated (but affects
other objects involved in conditional separation) and then will continue, until the
conditional separation state is defined for a separator, the state of which does not
affect any separator. It is impossible to create cyclic conditional separation.
Conditional separation can enable or disable separation with the following methods:
For all objects included in a separator. In this case the Conditional split sepa-
rator property should be used.
For individual objects included in a separator. The Conditional split column
in the separator editing window should then be used.
Using a combination of the properties described above.
The following specifics should be taken into consideration when conditional sepa-
ration is implemented:
The following items can act as an object storing conditional separation value:
○○ Boolean-type constant that is not separated by the separator for which
conditional separation is configured.
○○ Boolean-type attribute of a reference configuration object that:
□□ is not included in the separator for which conditional separation
is configured;
□□ should act as a type of another separator and the separator of this type
should be the only one.
On system startup an initial setting of session options storing the usage flag and
separator values is performed according to the startup command line options or
values specified for the infobase user. For details on setting separator values on
startup, see page 2-910.
If common attribute separation is conditionally disabled:
○○ When data are read or written, the values of the current session options
managing separator value and usage are ignored. In this case the following
values are used:
□□ Usage flag – True (the separator is used).
□□ Separator value – the default value for this separator type.
2-902 1C:Enterprise 8.3. Developer Guide
○○ When infobase user data are read or written, values of the current session
options managing separator value and usage are ignored. In this case the
following values are used:
□□ Usage flag – False (the separator is not used).
□□ Separator value – not used.
If the value that determines conditional separation is not read or unambiguous,
an exception is raised.
If the separator used in another separator's conditional separation is not used,
the other separator is also considered as not used.
If all separators are disabled in the session (using conditional separation),
infobase actions previously not available become available if at least one sepa-
rator is used.
If conditional separation is configured both in the common attribute property (the
Conditional split common attribute property) and using the Conditional split column
of the common attribute contents, one of the following values will be used as the
separator value:
The current separator value (set in the corresponding session option), if condi-
tional separation is enabled both by the object (an attribute or a constant)
specified in the corresponding common attribute contents column and by the
object (an attribute or a constant) specified in a separator property.
The separator type default value, if conditional separation is disabled with any
method.
NOTE
Conditional separation does not work in the Designer. It is considered that
attributes are always enabled in a Designer session.
We have the Subscriber common attribute of the Number type. The Products
catalog is included in this attribute with the following contents:
Code Name Subscriber
1 Sandals 0
2 Boots 1
3 Felt boots 2
4 Sneakers 1
5 Slippers 0
is conditionally enabled (for the Subscriber separator). In this scenario the
following items are available in the catalog:
Code Name Subscriber
2 Boots 1
4 Sneakers 1
The CompanyGroup separator includes all the catalogs noted (except for the
CompanyGroup catalog), since we need a separate list of organizations and RRI
content for each company group.
The CompanyGroup catalog is not included in the Organization separator, since
it is required by conditional separation rules (see page 2-900).
2-906 1C:Enterprise 8.3. Developer Guide
Now for every CompanyGroup separator (CompanyGroup catalog item) you can
specify the SingleRRI attribute value:
The attribute is set to False – conditional separation is disabled and for any
Organization separator value (within one value of the CompanyGroup sepa-
rator) there will be a single set of Banks, Currencies and VATRates catalog
values.
The attribute is set to True – conditional separation is enabled and for any
RRI separator value (within one value of the CompanyGroup separator) there
will be an individual set of Banks, Currencies and VATRates catalog values.
Actually, when the SingleRRI property is changed, conditional separation for the
Organization separator is enabled or disabled.
Suppose that the following records exist in the CompanyGroup catalog:
Name SingleRRI Reference
Progress False GL1
Trading house True GL2
The following records exist in the Organization catalog (two records for every
CompanyGroup separator value):
Name CompanyGroup Reference
Component parts base GL1 ОР1
AC World GL1 ОР2
Trade and Building GL2 ОР3
Light GL2 ОР4
Let's have a look at which data will be accessible in different sample scenarios.
Example 1
The SingleRRI attribute for the Progress item is set to False.
This means that separation is disabled for the Banks catalog. So this catalog’s
contents do not depend on the Organization separator value and the value equal
to this separator type default value will be written to the Banks catalog item (for the
Organization separator). In our example, this value is an empty reference (since
Chapter 24. The Data Separation Mechanism 2-907
Suppose that the following two records exist in the Subscribers catalog:
Name SeparateWarehouseList
Subscriber 3453 True
Subscriber 4617 False
If a user logs in on behalf of subscriber #3453, it is possible to keep a separate
warehouse list for each organization, since the SeparateWarehouseList attribute
is set to True (Warehouses catalog separation is enabled in the Organization
separator).
At the same time, when a user logs in on behalf of subscriber #4617, the list
of warehouses will be the same for all organizations, and the SeparateWare-
houseList attribute will be set to False (Warehouses catalog separation
is disabled in the Organization separator).
Example 3
You need to determine which values for the User column will be returned by
GetEventLogFilterValues(). Two separators are created in the system and the
current session uses the first one and does not use the second one. Thus:
For the first separator, the method returns only those users who were registered
in the event log for separation values equal to values in the current session.
For the second separator, the method returns all users (for more details, see page
2-1240).
Thus in the session with the specified state of separators the method returns
only those users that are an intersection of lists for the first and the second sepa-
rators (the AND operation).
If separator usage and the separator value (see below) specified in the startup line
are different from values specified for a user, then:
If a user has the rights to change session parameters, storing the separator value
and usage flag, these values are set from the startup command line.
If these rights do not exist, authentication fails.
Description:
Every <Flag><Value> pair is used to set one separator. You can't skip
separators. The <Flag><Value> pairs order matches the order of separators
in the configuration window. If the common attributes order is changing (for
example, the list of common attributes is sorted), you need to change the values
order in the Z option. <Flag><Value> pairs are comma separated.
Parameters:
<Flag>
Separator usage flag. It can have only "+" (default) and "-" values. If the "+"
flag is specified before the separator value (or no flag is specified), the spec-
ified value will be written to the session option storing the common attribute
value and the session option storing the common attribute flag will be set to
True.
If the "-" flag is specified before the separator value, this means that the
separator is not used in this session (the session option controlling sepa-
rator usage will be set to False), but if the value is specified, it will be
written to the session option storing the common attribute value.
<Value>
Specifies the value that will be set to the session option storing the value of
the corresponding separator. The separator value is set in the text form in the
following format (depending on the separator type):
For the Boolean type, a 0 (False) or 1 (True) value is set.
For the Number type, a number is set in the canonic form.
○○ For the Data type, a date is specified in yyyymmddhhiiss format, where:
○○ yyy – year (4 digits);
○○ MM – month number (two digits);
2-912 1C:Enterprise 8.3. Developer Guide
In this example:
The first separator is not used, but its value is indicated: "0".
The second separator is used and its value is "001".
The third separator is used and its value is the default value for the type
specified as the common attribute type.
The fourth separator is not used, but its value is "-3".
This option can be also specified in the default.vrd file (in an infobase connection
string) for publication on a web server.
There is another method for specifying separators in the default.vrd file, for more
details see page 2-913.
For instance, the code called should only operate within separator values that the
calling party has set for this code and should not attempt to switch to other data
areas. Any such attempt may result in an unauthorized access to data of an "alien"
area.
To prevent any attempts to change separator values (and, consequently, the data area
where the program code is being executed), you can set the safe data separation
mode. To do this, use the SetDataSeparationSafeMode() method. Applying
this method for the separator is similar to specifying the safe="true" attribute for
the zone item of the default.vrd. file. This file is described in "1C:Enterprise 8.3.
Administrator Guide". Where the safe mode is enabled via the default.vrd file, you
cannot disable it by using the SetDataSeparationSafeMode() method.
In the safe data separation mode it is not permitted to:
disable separator use, if the separation is not conditionally disabled;
change the value of the separator used, if the separation is not conditionally
disabled;
change objects that manage conditional separation:
○○ specified for the separator itself;
○○ specified for objects included in the separator.
You can set the safe data separation mode for each separator individually. The safe
data separation mode should be enabled and disabled the same number of times.
However, if the safe data separation mode was enabled (one or more times) within
the procedure or function but was not disabled, the system will automatically
disable the mode as many times as its disabling was not completed within that
procedure or function.
If within the procedure or function the safe data separation mode was disabled for
the selected separator more times than it was enabled, the system calls an exception.
The execution of this mechanism can be described as follows (there is Subscriber,
an independent separator, in the system):
For each SeparatorValue From ListOfSeparatorValues Do
EndDo
Chapter 24. The Data Separation Mechanism 2-915
You can check the status of the safe data separation mode by applying the
DataSeparationSafeMode() method.
Infobase time zone – if independent separators are not defined in the configura-
tion, this parameter value becomes undefined, otherwise the value is deleted.
If no separators are used in the session, the following infobase settings will be
filled with default values:
○○ data lock timeout.
○○ minimum user password length.
○○ user password complexity check.
○○ full text search permit.
If the compatibility mode is set (version 8.3.2 or older), predefined data
receives either values determined in Designer or default values. If the compat-
ibility mode is disabled, predefined data will be created when first queried.
The ThisNode item attribute values of exchange plans will be set to their
default values.
Values of nonseparated constants receive default values, values of separated
constants are deleted.
DEVELOPING SOLUTIONS
FOR THE MOBILE PLATFORM
25.3.3. Form
Mechanisms or configuration objects that are not supported by the mobile platform
have no associated form item properties available. For example, the Shortcut prop-
erty or events related to drag-and-drop operations.
The principles and rules of form generation for the mobile platform are generally
identical to the ones for thin client, but there are certain peculiarities that should be
taken into account while developing forms for a mobile application:
Smartphone displays are mostly vertically oriented (portrait orientation);
therefore, forms have significant width limitations and insignificant height
limitations.
Horizontal scrolling is not generally used in mobile devices, as scroll bars are
not permanently displayed on mobile device displays, and users might fail to
notice that a form (report or table) only displays partial information.
Instead of editing data in a row of a table associated with a tabular section or
value table, the mobile platform provides a special system form. This form
contains all columns for the current table row that are displayed on the parent form.
When you use this form, keep in mind the following peculiarities:
Columns with the View only property selected are displayed in the system form,
but are not available for editing.
2-920 1C:Enterprise 8.3. Developer Guide
The system form does not display picture and label fields.
Conditional form appearance applies to the system form.
All event handlers are called.
The system form cannot be edited in Designer nor be modified via the
1C:Enterprise script.
The following form items can be used in a mobile application form:
Field types:
○○ Text box
○○ Label field
○○ Radio button field
○○ Picture field
○○ Checkbox field
○○ Spreadsheet document field
Button
Table
Decoration: label and picture
All group types
The dynamic list used in the mobile platform has the following distinctive features:
Only the main table can be used.
Custom query cannot be used.
Attributes cannot be accessed using dot operator.
Dynamic list settings can be managed via the 1C:Enterprise script. To enable
interactive setting, implement the relevant configuration forms yourself.
Interactive list display is not supported.
Implementation of the Go to beginning and Go to end commands facilitates
navigation to the top or the end of list.
The form navigation panel uses a special menu that opens as described below:
In iOS, click the window header if it is underlined.
In Android, use the system button opening the menu.
In iOS, software buttons are available in the application title. The following rules
apply to the display of form buttons in the application title:
If a form contains a default button:
○○ Right-hand part of the title is displayed:
□□ Default button (with its title).
○○ Left-hand part of the title is displayed:
□□ Button with the Cancel command and its title (if the command
is available in the form).
Chapter 25. Developing solutions for the mobile platform 2-921
□□ Nothing is displayed, if the right-hand part of the form displays a button
with the Close command.
□□ Otherwise, a button with the Close command.
○○ Buttons displayed in the application title are excluded from the form.
If a form does not contain a default button:
○○ Right-hand part of the title displays:
□□ Button with the Cancel command and its title (if the command
is available in the form).
□□ Otherwise, a button with the Close command and its title.
□□ Buttons displayed in the application title are excluded from the form.
If the form displays a table related to a dynamic list that serves as the main
attribute of the form, the right-hand part of the title displays the Create button
(provided that the View only property is not selected for the table).
If the choice mode is selected for the form, the left-hand part of the title
displays the Close button.
The list of standard commands does not include commands for direct deletion (for
reference type objects), opening Help, list display and form modification.
Mobile devices may handle these commands differently, depending on the oper-
ating system version and device type.
3. You can subscribe to coordinate updates. Once the subscription is no longer
needed, you can disable coordinate change notifications.
After acquiring location data, you can perform certain auxiliary operations with the
obtained location:
Get an address based on coordinates. Use the GetAddressByLocation()
method.
Get location coordinates based on an address. Use the GetLocationByAd-
dress() method.
Display the map with the coordinates for a single point or for multiple points.
Use the ShowOnMap() method. Please note that iOS will always use the Apple
Maps application, while Android will use Google Maps.
NOTE
For methods for converting coordinates to an address and vice versa to work, your
mobile device must have internet access.
25.3.7. Reports
You can generate reports on the mobile platform using one of two different
methods:
Process the existing data and generate a report in the 1C:Enterprise script.
Implement a form in the mobile platform that can be used to set report genera-
tion parameters (such as filters) and generate a report in a remote system that
will return a spreadsheet document to be displayed on the mobile device.
Selecting one of these options depends on a number of factors:
Availability of all data required to build a report in an infobase of the mobile
application
Availability and quality of the communication channel between the mobile
device and the remote system
Complexity of the report
How the exchange with the remote system is set up
How you intend to work with the report
Other factors
Chapter 25. Developing solutions for the mobile platform 2-925
If you decide to generate a report on your mobile device, you must bear in mind
the mobile platform features (see page 2-1247). Data can be retrieved using selec-
tions, and the report can be generated using software-based spreadsheet documents
(based on a template) and charts (where necessary) generation.
If the mobile application has a permanent high-speed communication channel with
the remote system that contains all the required data for report generation, you can
implement report display options (such as filtering or viewing details) only on the
mobile application side. In this case the report itself is generated in the remote
application and is then returned and displayed on the mobile device.
All intermediate options can also be used: for example, if periodic exchange
is implemented, you can generate report settings on the mobile device and transmit
them to the remote system in an exchange session in order to obtain a generated
report for display.
Interaction with the remote application can be set up using a web service (provided
by the remote application) and data exchange based on an exchange plan, etc.
If a report details display needs to be implemented, please be aware that the mobile
application itself can only display values specified as report cell details. Other
actions should be implemented in the 1C:Enterprise script, including the retrieval
of a new report variant based on the assigned filters, etc.
of a picture for a toolbar is 16 dots, the set of pictures shall contain pictures
of the following sizes: l=16, m=24, h=32, x=48 dots.
The archive must always include the "l" image (basic image). Other images are
optional. If the required image is missing, the system uses the image that resembles
it the closest in terms of size. You can place the image archive:
In the image library
In Image type configuration object attributes
In the Picture, ValueStorage, BinaryData object created in the
1C:Enterprise script
We recommend you use PNG-format images when you create the archive. If you
place compressed images (PNG, JPG, etc.) in the archive, we recommend you
do not compress the archive. In all other instances, we recommend you create
a compressed archive.
The basic image is used in the following cases:
In an applied solution operating under 1C:Enterprise for PC
In image export to other data formats
In data transfer from server to client
Devices running iOS use the following images from the set:
Regular displays – "m" picture
Retina displays – "x" picture
Devices running on Android use images corresponding to the display resolution of
the device used.
Use the Product – Edit Scheme menu item in XCode to open the options dialog
for the current run scheme. In the dialog that opens:
○○ Select the 1cem value in the Scheme property.
○○ Select the connected phone in the Destination property.
○○ Select the Release value in the Build configuration property.
○○ Click OK.
Run the project using the Product – Run menu item in XCode.
The mobile platform is then sent to the mobile device and launched, and its
icon is included in the list of applications installed on the mobile device.
The mobile device can now be disconnected from your Mac computer, and the
mobile platform can be launched by pressing the 1C:Enterprise icon in the
application list. If the 1C:Enterprise mobile platform for developers launched
from XCode is running on the mobile device when you disconnect it, it is shut
down.
Where Platform directory is the directory where 1cem.apk file is located.
The mobile platform is then sent to the mobile device, and its icon is included
in the list of installed applications.
Now the mobile device can be disconnected from your computer, and the
mobile platform can be launched by pressing the 1C:Enterprise icon in the
application list.
Directory – specifies a physical directory on your drive that will store the
mobile application configuration file in .xml format and will be mapped to the
virtual directory on the web server.
The Update mobile application when a database configuration is updated checkbox
manages the automatic update of the mobile application configuration when the
database configuration is updated. If the checkbox is selected, the configuration
is updated.
You can also enforce the configuration update by selecting Configuration –
Mobile application – Update published application. If the mobile application was
not published before you chose this command, it opens the publication dialog
described above.
CAUTION!
It is the database configuration, rather than the configuration being edited, that
is published on the web server.
To launch the publishing process itself, click the Publish button. The process
includes the following actions:
If the Create virtual directory on web server checkbox is selected, the virtual
directory is created on the web server;
A directory mapped to the virtual directory is created on the drive;
You are prompted to dump the mobile application configuration into the direc-
tory (specified in the Directory attribute of the publishing dialog);
checked check of whether the database configuration matches the configuration
being edited is performed;
If the infobase configuration does not match the configuration being edited, you
are prompted to update the database configuration. You can skip this operation
if you want to publish the database configuration;
A mobile application checkup is performed (see page 2-1025);
If no errors are found, the infobase configuration is dumped into the file; other-
wise, dump is not performed.
The mobile application configuration file dumped using the Publish command has
a fixed name, 1cema.xml. This is the file that you search for (and update) when
you choose the Update published application command.
TIP
When you create a virtual directory, the configuration file (1cema.xml) is set as
its default page. This allows you to specify a short URL in the infobase creation
dialog on the mobile device.
The Disconnect button in the mobile application publishing dialog cancels
publishing by removing both the virtual directory from the web server and the
physical directory.
Chapter 25. Developing solutions for the mobile platform 2-931
CAUTION!
Once you delete the application, infobase data cannot be restored.
Android SDK supplied by Google. You can download this kit from the Google
website: http://developer.android.com/sdk/index.html.
Working with the data processor includes the following steps:
1. Set up the application (use the Settings button to open the relevant dialog).
Specify installation directories for the corresponding SDKs, location for mobile
platform files (prjandroid.zip and prjios.zip) and location for files created upon
completion of the application creation process. If you intend to create applica-
tions for an Android platform, create a certificate file to sign the application.
You can do this in the setting form.
If the applied solution uses location tools and is installed on Android, obtain
the SHA-1 hash value for the certificate file. This value is used to obtain the
key required for using Google Maps. To obtain the hash value, click the Get
SHA1 hash button on the Key parameters for Android tab of the settings form.
2. After you configure the settings, specify the operating systems for which the
applications are assembled.
3. Then select the configuration of the mobile application to be added to the
archive. Use the Mobile application configuration field.
4. The system auto-fills the Application name.
5. The Application name field contains the text to be displayed as a label for the
application icon on the mobile device display. The field itself displays the text
in the localization language of the current 1C:Enteprise session. You can edit
this presentation by clicking the magnifying glass button in the right-hand part
of the field. If multiple languages have been created in the selected configura-
tion, the application presentation can be edited in all configuration languages.
6. The Default language field specifies the language used for the presentation if the
localization language of the mobile device is missing from the list of mobile
application localization languages.
7. The Application ID field is a unique mobile application ID that expressly iden-
tifies the application among other applications in the application store. We
recommend setting the application ID using the following template: com.e1c.
ApplicationName. ApplicationName is the name (not the presentation!) of
the mobile application in the English language.
The data processor generates the application ID using the Name configuration
property. If this property is set in the Russian language, the application ID
should be specified manually (in the English language).
The data processor does not support application ID input in any language other
than English.
8. If you intend to use location tools in Android OS, you should get the key for
working with Google Maps. To do this, copy the SHA1 hash for getting the key
for accessing Google Maps field value and use it in your developer account
Chapter 25. Developing solutions for the mobile platform 2-935
to obtain the key for Google Maps. Enter the key into the Key for accessing
Google Maps field. This operation needs to be repeated after every change to
the developer's certificate file.
If you do not intend to use location tools in Android OS, you do not need to
enter (and obtain) the key.
9. You can use the Set icons and logos command to specify image files to be
displayed on the mobile device.
CAUTION!
During application development, you are only allowed to change application
resources (icons and logos) if they are specified in the Set icons and logos form.
Changing other mobile application resources is not allowed.
10. After you set all the parameters, click the Create button. If the creation process
is successfully completed, files <ApplicationID>.zip (for iOS) and <Applica-
tionID>.apk (for Android) are created in the folders that were indicated as
application locations. <ApplicationID> is the text from the Application ID field,
e.g. com.e1c.test.apk.
11. The APK-file is ready for immediate installation on the mobile device, while
the ZIP-file can be installed on the mobile device using XCode running on
a Mac computer. For a description of the installation process, see page 2-927;
however, remember to use the <ApplicationID>.zip file instead of the prjios.zip
archive.
Create an application archive using the Product – Archive command in XCode.
Open the Organizer tool using the Window – Organizer menu item in XCode.
Go to Archives in the upper panel.
Select the created archive and click Distribute.
Follow the instructions provided by the wizard.
DEVELOPMENT TOOLS
Thus, you can select form elements in the element editor and in the preview
window. Functionality in the preview window is nearly similar to the functionality
in the element list. In particular, element context menus, the properties window,
element dragging, etc. are available. When an element is selected in the preview
window, a frame is shown around the element that can have different colors based
on the element:
Frame color Description
Blue Selection of a normal element.
Orange Selection of automatically created buttons and command bar submenus. It is used to
indicate that the configuration (properties, position) is not available for this element.
Grey Selection of a parent element if the selected element can't be selected in the preview
window. For example, if you select the text box context menu in the element list, the text
box will be highlighted in grey in the preview window.
Green Used when elements are dragged, the control to which the selected element is dragged
(e.g., a table or a form group) and the indicator of the position where the dragged
element will be placed are shown.
If you need to select a parent element (e.g., a group containing a field) for any
other element, you can left-click the subordinate element twice sequentially.
This selection is possible if the interval between the two clicks is 1 to 2 seconds.
If the interval is less than 1 to 2 seconds, the system can interpret it as a double
click; if the interval is greater than 1 to 2 seconds, the system can interpret it as
separate actions. If on the first click several elements are selected, the parent
element will not be selected.
The Go To command is used to quickly move to linked objects. This command
is located in the object context menu in element editors, command interface frag-
ments, attributes, commands and the preview window. This command can be used,
for example, to quickly move from a form element (selected in the element list or
preview window) to a form attribute displayed by this element. If you can go to
several elements, a window with a prompt to select the object you need will be
opened.
2-940 1C:Enterprise 8.3. Developer Guide
Also, in the form editor, you can quickly create (or go to) event handlers of certain
form elements using the Events submenu of the element context menu.
This menu includes all events available for this form element in the properties
window of this element. If an event name is specified in angle brackets in the
menu, the event handler can't be determined (for example, for the Clearing event
of the Organization element in the fig. 333. You should select the event you
need to create the handler – the form module editor will be opened and the handler
will be created.
If the event handler has already been created and you click the corresponding
command in the Events submenu, you will be moved to the existing handler in the
form editor (for example, OrganizationOnChange() handler in the fig. 333.
The Events submenu is not generated for a button, and the GoTo command for
a corresponding command handler is located directly in the element context
menu.
Chapter 26. Development Tools 2-941
If you create a client handler, the system has multiple creation options available:
If you select the first option (Create on client), a client event handler only
is created. In the Create on client and a procedure on server (no context)
option, a client event handler is created along with a server-side procedure
with no context, and the procedure is called from the client handler. In the last
option a server-side context procedure is created. If context server calls are not
recommended for a certain client event handler (you can find this information
in the Syntax Assistant), the last option (with the server-side context procedure)
is unavailable. Deleting an event handler does not remove the server procedure
(if the latter is created during event handler creation).
When an attribute is deleted (from a form attribute list), the Do you want to delete
the related items? message is displayed. If the answer is negative, the Data prop-
erty is cleared for linked form elements. If the answer is positive, form elements
linked to the deleted attribute are deleted. If the link with this attribute is not the
main link for the element (footer data, data displayed in the group title, etc.), this
element is not deleted, but the link with the deleted attribute is cleared. Regardless
of the answer for the deletion prompt, form command interface commands linked
to the deleted attribute will be deleted.
When a form command is deleted, the user is prompted to delete all linked
elements. If the answer is negative, form elements are not deleted, but the
Command element property is cleared. If the answer is positive, buttons linked to
the deleted command are deleted.
When you develop a form that you wish to display in both the Taxi and Version
8.2 interfaces, you need to see how the form is displayed in both interface modes.
You can do this in the form editor.
See fig. 335 for an example of how the display changes when you switch from the
Taxi interface (upper left-hand view) to the Version 8.2 interface (lower right-hand
view). Please remember that some items are displayed in the Version 8.2 interface
when you test the form in the Taxi interface.
The Interface mode button is only available if the Interface compatibility mode
property is set to Taxi. Version 8.2 allowed or Version 8.2. Taxi allowed. Otherwise,
this button is not displayed in the form editor.
To open and check a form, press Ctrl + R. The form opens in a new window.
2-942 1C:Enterprise 8.3. Developer Guide
Editors for all the above properties are identical both in appearance and in opera-
tion. Review how editors work using the View property as an example.
The View property (in the upper part of the editor window) defines visibility
for each role with the check box in the third position (shaded check box). Then
visibility status for all the available roles are added up using the OR concatenation
and the result determines the final View property value for the edited object.
When this mode is on, a regular text document is displayed with the font set as
default for module text in the Designer parameter settings (Tools – Options menu
item, Texts tab, Font attribute).
The parameter settings in the 1C:Enterprise system allow the syntax color high-
lighting to be turned off; in this case selecting the Script item does not enable the
color highlighting for module syntactic constructs, but uses the module print and
tab spacing settings only.
If the syntax color highlighting mode is switched off, operating system colors are
used for typing out the text.
26.2.1.2. Group
In modules or text documents viewed in the Script mode some syntactic constructs
are automatically grouped. These include If … Then … EndIf, While … Do …
EndDo, Procedure … EndProcedure and others.
Text groups improve readability of different text parts and support move and copy
functions for entire groups. See fig. 338 to understand how groups are displayed.
You can expand or collapse a group with the mouse. To do this, simply left- click
on the group marker.
If you hold down the Ctrl key while clicking all nested groups (conditions, cycles,
etc.), they also collapse or expand.
To display collapsed text move the cursor over the marker, as shown on fig. 338.
If the text is too large, only its initial part appears.
2-946 1C:Enterprise 8.3. Developer Guide
All rows within a region that is limited by the preprocessor directives can be
collapsed in the module editor (just like other 1C:Enterprise script syntactic
constructions). Each region must have a name based on the 1C:Enterprise script
rules. In the example shown on fig. 340, the region is named PictureFile.
Regions can be nested, but they cannot overlap with other syntactic constructions
of the 1C:Enterprise script. A number of examples, both correct and incorrect, for
using regions can be found below:
// Correct example of using a region
#Region Correct
…
#If Client Then
…
#EndIf
…
#EndRegion
// Nested regions
#Region CalculationAlgorithm
…
#Region Stage1
…
#EndRegion
…
#Region Stage2
…
#EndRegion
…
Chapter 26. Development Tools 2-947
#EndRegion
A region can be described using a comment inserted before the region (#Region).
The comment can also be grouped.
Groups can be easily manipulated using keyboard shortcuts.
Keyboard shortcut Actions
Ctrl + Num - Collapses the group (cursor can be anywhere in the group)
Ctrl + Num + Expands the group (cursor has to be over the first line of the group)
Ctrl + Shift + Num - Collapses all the groups
Ctrl + Shift + Num + Expands all the groups
Ctrl + Shift + R Refreshes the groups
During write operations groups are automatically created for all syntactic constructs
of any nesting level by completing the writing of the syntax statement. Groups can
be updated using the Text – Groupings – Refresh Groups item or automatically
when saving text according to the group display settings.
Description of procedures, functions, and regions is considered the first level and
the second level is syntactic constructs that are nested in procedure or function
body, but not in the body of other syntax statements. Group display mode can be
set up. For information about mode setup see page 2-1153.
While True Do
Selection = Catalog.Select();
Continue;
Else
Abort;
EndIf;
If Selection.IsFolder Then
Continue;
EndIf;
Return;
EndDo;
EndProcedure
1C:Enterprise text editor automatically deletes spaces at the ends of the lines.
This is performed while recording a module.
To navigate to a needed procedure or function, select its name on the list and press
the Go To button.
Names of events with no handler procedures are shown in angle brackets in the
procedures and functions list. Created procedures and functions are marked with
P() and F(х), respectively, displayed in front of their names. Events that can be
handled are defined by the object and form type as well as the controls located
in the form. When this kind of line is selected, predefined procedure text is added
to the module and a reference to the procedure is added to the appropriate event
in the Events category.
IMPORTANT!
Event handler procedures (defined by the system for a module) should be cre-
ated within the form properties palette, the Events category, by using either the
Procedures and functions window or the Procedures and functions list box. If you
simply try to copy the event handler procedures from different modules, the event
handlers from other modules will not be initiated in the form and the copied
procedures will not be called up to process the events.
When moving the cursor to the module line, the name of the current procedure or
function is shown in the procedure selection field of the Module toolbar (Proce-
dures and functions command). Using this list, you can switch to the needed
procedure or function.
To navigate to a procedure, function or variable, click the appropriate name with
the mouse and press F12. Switching is possible only for procedures, functions and
variables placed in this module or procedures to be exported, functions and vari-
ables of application module, common modules and object modules. To return to the
initial point of navigation press Ctrl + - (next to the = key).
If the recorded expression consists of parts defined in different configuration loca-
tions, prior to switching the list of similar objects appears on the screen in order
to choose the switch. You can navigate to a variable definition, metadata object
Chapter 26. Development Tools 2-951
definition with the object type equal to the current expression or procedure or func-
tion definition used in the expression (for example, in a module of the object with
the type matching that of the expression).
For example, if F12 is pressed for the Cat.FindByCode() expression where Cat
is defined as Currencies catalog, it displays a list of navigation to the Cat vari-
able definition and the Catalogs – Currencies metadata object definition in the
configuration object tree.
Text is entered from the list displayed as a context menu at the current cursor
position (relative to the screen edges).
The list is called by pressing Ctrl + Spacebar at any stage of expression entry or
automatically upon entering the . character after an expression that represents an
object with properties or/and methods (if the contextual help is enabled, see page
2-1154).
The contents of the list depend on the program module execution context (see
section "1C:Enterprise Script Overview") and previously entered text.
At the initial stage, before text has been entered or when only the first expression
characters have been entered, the list structure is defined by the execution context.
The list is shown as alphabetically sorted text lines.
If a text fragment is entered when the list is being opened, this list is positioned
on the first line with a name that contains as much of the entered or selected text
as possible (starting from the beginning of the name). If the entered text is not
included in the lines on the list, the line that best represents the entered text is acti-
vated.
If the typed expression is a system enumeration, the list can be opened simply by
pressing the = key.
When the list is opened, it is possible to continue entering text. In this case lines
matching the entered text are activated in a sequence.
2-952 1C:Enterprise 8.3. Developer Guide
The list can be viewed by the standard method. By pressing the Enter key, the
contents of the chosen line is transferred to the module, replacing the selected or
entered text.
NOTE
When text is transferred to the module, method parameters are not inserted and
client application context is used.
To the left of the lines there are icons showing the object type and location.
Icon Object
Line (black) ■■ Global context properties
■■ System value sets
■■ Enumerations
Line (green) ■■ Universal value collection object properties
■■ Interface object properties
■■ Application object properties
■■ Predefined items
Line (blue) Exported module variables
Line (red) Local module variables
P() (black) Global context procedures
P() (green) Interface and application object procedures
P() (blue) Other exported module procedures
P() (red) Local module procedures
F() (black) Global context functions
F() (green) Interface and application object functions
F() (blue) Other exported module functions
F() (red) Local module functions
Colored lines Keywords (If, Do, Try and others)
Template picture Text template
Text templates are included in the list only if an auto-replace string is specified
in it.
If after entering the text or selecting it from the list the text is an expression with
properties or methods, then after entering the "." character a list of properties and
methods available for this expression is displayed automatically.
For example, if Catalogs. is entered, the list containing names of all catalogs
described in the current configuration appears. After a certain catalog is selected
and the "." character is entered, the list appears again, but unlike the previous
list, it contains procedures and functions for working with the catalog as well as
predefined catalog items. If the selected method returns a value of the type with
properties and methods, contextual entry can be continued (it is essential to enter
the opening and closing brackets at the end of the name). The context tip list
contains the only available set defined by the type of the expression entered.
Context tips can also be used for module variables.
Chapter 26. Development Tools 2-953
Context tips can be used when entering the New operator and for variables created
using the New operator.
Context tips can be used when entering different keywords (like If, For, Do
and others). Keywords form a list opened in the standard way by pressing
Ctrl + Spacebar at any time while typing the word.
Keyword display in the list can be set up (see page 2-1154).
If the list for any variable or method consists only of one line, then by pressing
Ctrl + Spacebar, the line will be inserted.
Context help can also display a list of parameters and a method type. Parameters
are displayed both for global context objects and 1C:Enterprise objects as well as
for applied solution methods that are properly described. Parameters are displayed
after you type "(" or "," characters (for further information on configuring these
characters, see page 2-1154) or after you press Ctrl + Shift + Spacebar on the
keyboard after entering the "(" character for a procedure or function call.
If a method has multiple syntax options, the first option is displayed. The up and
down arrows are displayed above the syntax description. You can use these arrows
to select the options. You can also select an option using the Ctrl + Up Arrow and
Ctrl + Down Arrow keys.
The type of value that can be passed to this parameter is displayed below the
parameter description. If the value can have multiple types, these types are sepa-
rated by a comma. Each type name is a hyperlink that you can click on to open
the Syntax Assistant (see page 2-1170) and display the type information. Parameter
context help is closed when you enter the ")" character or press Esc in the open
parameter context help window.
If you want context help to display the parameter description and types for applied
solution methods, add a comment based on specific rules prior to the method.
In general, a procedure or function description contains the following sections:
Description section – contains a brief description of the procedure or function’s
purpose and/or operation. In case of a function with no parameters, it can be
the only section.
Parameters section – describes the procedure or function parameters. If no
parameters exist, this section is skipped.
Returns section – describes the type and content of the returned value of the
function. This section is not used for procedures.
Sample section – contains an example of using the procedure or function.
Comments use the following common format:
<Comment> =
[<HeaderSection>]
[<ParameterSection>]
[<ReturnedValueSection>]
[<SampleSection>]
<HeaderSection> = [<Text>]
Fig. 343. Context tip for the parameters of applied solution methods
Thus, the context tip mechanism in the 1C:Enterprise system text editor is a rapid
and proper way to enter module texts.
In the Designer parameter setup mode (Tools – Options item, Modules tab, Check
tab, Check automatically check box) the automatic module check mode can be
enabled. If the module has been changed, module syntax check is performed when
closing the module window or saving the configuration.
The automatic check mode should be used when debugging any configuration item.
For complete check syntax of all configuration modules in a single operation,
select Configuration – Check Syntax in Modules.
Tips on the 1C:Enterprise script are available in the module error correction
process. To access the tips open the Syntax Assistant and find description of the
applicable script item (see page 2-1170).
Tooltip on a particular 1C:Enterprise script item (operator, procedure, function,
property or method) can be accessed by placing the cursor in the module on the
appropriate item and pressing Ctrl + F1. Description for the selected 1C:Enterprise
script item is opened in the Syntax Assistant.
Enter the password and confirm it. To set up the password click OK; to cancel the
setup click Cancel.
If the password is correct, the module is opened. If the password is incorrect, the
Incorrect password warning appears and the module does not open.
Password Change
To change the password, open the module and choose the Text – Set Password
command. Password dialog appears on the screen. Enter the old password. If you
entered the password correctly, the new password dialog box appears on the screen
(see page 2-956).
To disable the password, clear the password text boxes and click the OK button
without typing a password.
#Area Heading1 RU
#EndArea
#Area Heading1 EN
#EndArea
If a language code is not indicated for any area variant, this area variant
is returned when language code that is not indicated in any of the area description
variants is transferred to the GetArea() method.
Each area consists of service and textual parts.
#Area ХХХХХ
[service part]
[text part]
#EndArea
#Field WorkType
#Alignment Justify
#Block <Parameter> – shows the necessity of filling the area for the field by "#"
characters. If <Parameter> = True and field contents do not fit in the allocated
place, the area is filled.
#Field ReportTotal
#Format "ND=18; NFD=2; NDS=."
#Block True
The number of spaces reserved for the field equals the number of characters
displayed in the brackets (brackets included). If the field size consists of only one
symbol, a single bracket can be used.
Example:
-----------------------------------------------------
![Name ]! [Code ]! [Description ] !
-----------------------------------------------------
If the field name immediately follows the left bracket, then that field has a left
alignment; if it is immediately followed by the right bracket, then it has a right
alignment. If whitespaces are placed to the left and to the right of the field,
it is centered inside the allocated spaces.
If the field name is larger than the assigned number of spaces, the name
is displayed using the Fields keyword.
Example:
#Field Number
#Format "ND=3; NFD=0"
#Field Code
#Format "ND=5; NFD=0"
#Field Label
#Format "ND=1"
-------------------------------------
![ ]! [ Code]![ Description ] ! [! #Field Number Label
-------------------------------------
Fields keyword parameters are only indicated for fields if their names are not
enclosed in brackets inside the template body.
Auto Wrap
If the text does not fit in the allocated field size, it may be necessary to use auto-
matic text wrapping to a new line. To do this, it is recommended to use a field
placement instruction in the template, using braces and angle brackets.
{FFFF} – field area is limited by braces. They show that the text stored in the
FFFF field can be auto-wrapped to this line and indicate the area for the text that
does not fit in the FFFF field. Even if the line does not need to output any of the
fields, it is output anyway.
<FFFF> – field area is limited by angle brackets. They show that the text stored
in the FFFF field can be auto-wrapped and indicate the area for the text that
does not fit in the previous line of the FFFF field. If all the fields in the line are
enclosed in angle brackets, but none of them has been used for text output, the
line is not output. If the text still does not fit when output from the field to the
line where the field in angle brackets is included, the line is duplicated until
the entire text can be output from the field.
Chapter 26. Development Tools 2-961
Example:
---------------------------------------------
![ YY]! [XX ]![ ZZ]!
! ! {XX }! !
! ! <XX >! !
---------------------------------------------
This example shows that the XX field is placed on the first line. The part of field
XX that does not fit on the first line is placed on the second line. The part of field
ХХ that did not fit on the first and second lines is placed on the third line. If field
ХХ has no text left for the third line, that line is not output at all, but if it did have
text left, the third line is output until the text from field XX ends.
Description:
This indicates the apparent end of the template area.
Syntax:
#EndArea
2-962 1C:Enterprise 8.3. Developer Guide
ReplaceChar
Description:
This keyword is used for character replacement inside the area lines.
Syntax:
#ReplaceChar <Character to be replaced> <Replacing character>
Parameters:
<Character to be replaced> Required
The character to be replaced is enclosed in single quotes.
<Replacing character> Required
This indicates the character replacing <Character to be replaced>.
Field
Description:
This indicates the field that needs formatting keywords specified for it.
Syntax:
#Field <Field name>
Parameters:
<Field name> Required
Field name.
Align
Description:
This indicates alignment for field contents output.
Syntax:
#Alignment <Alignment parameter>
Parameters:
<Alignment parameter> Required
Field alignment value. The following values are available:
Left
Right
Center
Justify
Chapter 26. Development Tools 2-963
Format
Description:
This indicates the field display format.
Syntax:
#Format <Format string>
Parameters:
<Format string> Required
It defines the field value presentation format.
Example:
"DF=dd.MM.yy"
Block
Description:
If the parameter value is True and the field value does not fit within the allo-
cated space, the entire space is filled with the "#" character.
Syntax:
#Block <Parameter>
Parameters:
<Parameter> Optional
It defines the necessity of field filling. Available values:
True
False
Fields
Description:
It indicates a list of fields with names that cannot be indicated in their allotted
area.
Syntax:
#Fields <Field name 1> <Field name 2> … <Field name N>
Parameters:
<Field name> Required
Field name. All field names that are not indicated in the template text area
should be specified.
2-964 1C:Enterprise 8.3. Developer Guide
#Area Header EN
Invoice N [DocumentNumber ]
From: [From ]
To: [To ]
=================================================
| N| Description | Price |Pieces| Sum |
#Area String EN
#Field Price
#Format "ND=10; NFD=2; NDS=."
#Field Pieces
#Alignment Right
#Format "ND=4; NFD=0; NDS=."
#Field Sum
#Format "ND=12; NFD=2; NDS=."
|--+---------------+----------+----+------------|
|[]|[Description ]|[ Price]|[ ]|[ Sum]|#Field Number Pieces
| |<Description >| | | |
#Area Footer EN
#Field TotalPieces
#Alignment Right
#Format "ND=4; NFD=0; NDS=."
#Field TotalSum
#Alignment Right
#Format "ND=12; NFD=2; NDS=."
=================================================
Total [ ] [TotalSum] #Field TotalPieces
Director: [Director ]
Procedure PrintToText(Button)
CurDoc text document is created during the procedure, and PrintText(CurDoc)
procedure which fills the text document using the invoice data is called.
The procedure is placed in the document module. The document is opened on
the screen after it is filled.
PrintText() procedure text:
Procedure PrintText(CurDoc) Export
// Get template
Template = GetTemplate("PrintText");
// Set language code
Template.TemplateLanguageCode = "RU";
// Header
Area = Template.GetArea("Header");
Area.Parameters.DocumentNumber = Number;
Area.Parameters.From = Format(Date,"DF=dd.MM.yyyy");
Area.Parameters.To = Contractor;
CurDoc.Output(Area);
Object visibility can be set up in the command interface using several methods:
Editing the Visibility column. In this case command visibility is set up for
all roles. Command visibility for a particular role is defined by the Visibility
column if a special visibility management box status is selected for the role
(see example of Sales subsystem visibility on fig. 346).
Selecting a specific visibility value (checked or unchecked) for a particular role
indicates whether the command is visible by default (or hidden – depending on
the check box status) for the role. Common status (Visibility column) is ignored
in this case. Thus, fig. 346 demonstrates that Goods inventory section
visibility for the Administrator role is disabled (though common visibility box
is checked) and command for navigation to the Enterprise subsystem for the
Sales manager role is visible by default (though default visibility for this
section is disabled).
Visibility status can be changed for multiple commands from the list.
To show only visible commands in the Command list press the Hide invisible by
default button.
The user can select a general layout of forms on the Start page in the Starting page
template field:
One column – the start page displays forms in a single column.
2-968 1C:Enterprise 8.3. Developer Guide
Two columns, same width – the start page displays forms in two columns of
equal width.
Two columns, different width (2:1) – the start page displays forms in two
columns and the left column is twice as wide as the right one.
After the required forms have been selected, the user can specify their sequence
order on the start page and height for each form (Height column).
Visibility editor is similar to other role-based properties editors (see page 2-942).
As the user develops the start page interface, he/she should pay particular attention
to placing the most important forms on the start page. These are forms that are most
frequently used by users with a particular set of roles.
Please remember that forms that cannot be viewed by the user due to insufficient
rights are not displayed on the start page regardless of the Visibility column status.
The editor includes two table boxes. The one on the right is used to edit the
command interface; the one on the left contains a hierarchical list of avail-
able configuration commands that can be added to the main section interface.
Commands in the Available commands list meet the following requirements:
They have no parameters.
Groups indicated for commands belong to the navigation or action panel.
The Command column of the interface editor table box displays structure of
commands grouped by action panel categories (Important, Normal, See also),
navigation panel categories (Create, Reports, Tools) and categories of commands
defined in the metadata tree branch Common – Command groups. The table box
Chapter 26. Development Tools 2-969
also contains the Visibility column. The system also creates command visibility
columns for each role defined in the configuration.
To select the required command expand the appropriate branch in the available
commands table and pick a command.
To move the command to the command interface select it and click Add command
to main section (alternatively, press Enter or double-click the command line).
The selected command is moved to the panel and group defined for the command
during setup of the current metadata object (Group property). If the Add command
to main section button is unavailable, the selected command cannot be moved to
the desktop. For example, it could happen if the Include in the command interface
property is not set for the enumeration.
Initial order of command display in the main section command interface and
visibility settings are set up by the system. The user can set up visibility for all
commands as well as for specific commands selected by roles to which these
commands are available.
Move a command button can be used for moving commands between groups.
Commands can also be dragged to the required position within groups of a single
panel. To set up command order in a group use up and down buttons.
Pressing the Set default properties button resets the command visibility settings and
group membership to the default system settings.
If the configuration has no subsystems, the editor looks differently:
In this case all system commands are available on the desktop and the user only has
to set their default visibility.
For rules of visibility management see page 2-966. For a description of filtering by
roles see page 2-967.
2-970 1C:Enterprise 8.3. Developer Guide
The system sets up the command order automatically. If manual setup of the
command display order is required, use buttons to move the commands up and
down or drag them. In this case a line saying (manual order) is displayed next to
the group. To undo the order changes select Restore automatic order in the group
context menu.
Move a command button can be used for moving commands between groups.
Commands can also be dragged to the required position within groups of a single
panel. To set up command order in a group use up and down buttons.
Pressing the Set default properties button resets the command visibility settings and
group membership to the default system settings.
For rules of visibility management see page 2-966. For a description of filtering by
roles see page 2-967.
Chapter 26. Development Tools 2-971
The Subsystems list defines the order of subsystems in the configuration tree.
This order does not affect the order of subsystems in the sectionsections panel.
To set up subsystem order in the sections panel, go to the root item in the Subsys-
tems list and set up the subsystem order.
Subsystem properties can be edited in the properties palette or subsystems editor
(select the subsystems and click Change current item).
To move a subsystem (together with subordinate subsystems) select it and click
Move subsystem. Use the selection window that opens to specify the destination
subsystem for the current subsystem. Transfer to subsystems that belong to the
current subsystem is not allowed.
For rules of visibility management see page 2-966. For a description of filtering by
roles see page 2-967.
2-972 1C:Enterprise 8.3. Developer Guide
Using the Next > buttons in the query wizard work your way through the tabs and
select the necessary source data, specify groups and conditions, set the desired order
and describe the resulting data. The wizard will create a form and template which
will be placed on the appropriate branches. Using the Query button you can open
a window with the text of the query generated from the specified data at any time.
2-974 1C:Enterprise 8.3. Developer Guide
The expression text is generated in the lower box. You can enter the expression
with the keyboard. For convenience in entering the names of attributes, you can
drag the desired fields from the fields list and select the desired query language
functions from the list by dragging them with the mouse to the expression text box
as well.
The wizard will also have the Links tab if you specify several tables.
The Links tab enables you to specify the criteria for the links between the table
fields. Click Add to enter a new criterion and select one of the tables from the
Table1 column; from the Table2 column select the table whose fields are linked
Chapter 26. Development Tools 2-975
with those of the first table. Controls that are used to create table link criteria are
located below the criteria list.
On the Grouping tab, if necessary, select the attributes by which items are to be
grouped.
Choose a condition for each selected field (for a custom condition, set the check
box in the Arbitrary column). If the check box is not set, select condition type and
specify parameter description. If the Arbitrary check box is set, you can use the
custom expression generation window (see above).
2-976 1C:Enterprise 8.3. Developer Guide
If temporary table creation has been selected on the More tab, fields to be used as
a basis for index can be picked on the displayed Index tab.
On the Unions/Aliases tab, enter field aliases if necessary (see fig. 360).
The table shows the mapping between the selected fields and source data. You can
change field names and mappings. To change the name select the field and press
Enter. Then enter the new field name. To change the mapping select the desired
row in the Query column and press Enter. Select the desired value in the drop-
down list.
If you need to select only unique values, check the box in the No duplicates
column.
Aliases for fields that have been changed by the user, loaded from the query text or
assigned mandatory aliases by the wizard at the alias generation step are displayed
in bold.
Chapter 26. Development Tools 2-977
Specify the result output order on the Order tab (if necessary).
As you can see in fig. 361, the user has selected to output data sorted by date,
while within a single date sorting by Vendor is used.
On the Totals tab, if necessary, specify which fields should be subtotaled and
whether overalls should be generated (see fig. 362).
If you press the >> button located next to the group fields, all reference fields are
placed into the group fields. If you press the >> button located next to the totaled
fields, all numerical type fields are placed into the list of totaled fields.
2-978 1C:Enterprise 8.3. Developer Guide
The report builder settings are provided in the Builder tab. Select tables and fields,
specify conditions, order of presentation, and describe the total data.
The Tables tab can be used to edit parameters of virtual table report builder
and mark optional tables. To edit virtual table parameters select the table that
requires parameter setup, call the Virtual table parameters command and enter
the table parameters required for the report builder into the new dialog box. To
mark an optional table clear the Required check box for the appropriate table.
For a group of optional tables you can also specify its number. Optional tables
with matching group numbers and adjacent link listing are combined into one
optional group. Optional tables with different group numbers are separated into
different groups.
The Fields tab can be used to select the fields that the report builder uses as
available fields in the report output.
The Conditions tab can be used to select the fields that the report builder uses as
available fields for filtering.
The Order tab can be used to select the fields that the report builder uses as
available fields to sort the results.
The Totals tab can be used to select the fields that the report builder uses as
available fields for report grouping.
The Query batch tab enables the user to create a succession of batch queries when
working with batch queries. Each query can be edited and configured in the same
window and all previous tabs allow switching between the queries being configured
(see fig. 363).
Clicking OK in the program module generates query text. If the wizard attempts
to open invalid query text, the cursor is automatically placed in the query line
containing the error and a troubleshooting message is displayed.
Chapter 26. Development Tools 2-979
Depending on the source of query wizard call (data composition system, query with
result processing, etc.), the wizard form can have new tabs that are described in the
calling mechanism description.
For accounting registers that do not support correspondence, specify the corre-
spondence type and the account; for those that do support correspondence, specify
the debit and credit accounts.
If a document has tabular sections and their data must affect the status of registers,
include the tabular section in the Tabular Section selection list.
Then fill the attribute formulas for each register using the data from the document
attributes.
In the list of formulas, place formulas that define how to calculate register records
from the selected document attributes.
You can create these formulas "manually" as follows. Enter the formula in the
Expression column for each register attribute selected in the list. You can type
it manually in this box or manually edit an existing formula there. The wizard
does not verify the formula accuracy.
You can also insert data of the corresponding attribute into a formula by double-
clicking in the document attribute list. The wizard does not check the agreement
of selected attribute types.
If at least one type belongs both to the register and to the register dimension/
resource and their names match, autofilling can be used for these subordinate
objects. When you press the Fill Expressions button, names of attributes are entered
in the Expression column and can be edited.
2-982 1C:Enterprise 8.3. Developer Guide
First, the wizard prompts to select the startup option for which the print module
is to be generated.
Chapter 26. Development Tools 2-983
Then it asks the user to create a new print command or modify an existing
command. Name must be specified for a new command. The default command
name is Print. The specified name is subsequently used as:
object command name;
command module server method name;
method name in an object manager that implements the print procedure.
If the user chooses to edit an existing command, the following texts are replaced
in the command module: CommandProcessing() handler, server method with the
command name (Print() in this case), object manager module method with the
command name and template.
After you press the Next > button, the wizard switches to selection of header attrib-
utes. Create the attribute list using the transfer buttons.
If the configuration object has tabular sections, then after the Next > button
is pressed the wizard switches to selecting attributes of the next tabular section.
The print list is generated the same way as the header attribute list.
If the configuration object has tabular sections, then after the Next > button
is pressed the wizard switches to selecting attributes of the footer.
Then the user should select the group for the created command and specify certain
parameters of the generated document.
In the upper part you can see a list of base objects and a list of attributes for the
base object selected in the first list.
2-986 1C:Enterprise 8.3. Developer Guide
The lower part displays a list of attributes for the resulting object.
The object attribute list must be supplemented with formulas to specify how the
document attributes are filled from the selected attributes for the base object.
These formulas can be created "manually" as follows. A formula is defined in the
attribute entry Formula text box for the attribute of the object selected in the list.
Formula can be manually entered or edited in this box. The wizard does not verify
the formula accuracy.
By double clicking in the list of attributes of the base object you can also insert
correctly represented data of the corresponding attribute in the attribute entry Formula
text box. The wizard does not check the agreement of selected attribute types.
You can also combine these two methods: when placed in the text box, data from
the list of attributes of the base objects do not replace all of the information already
there, just the selected characters.
Clicking the Fill Expressions button after request and confirmation creates filling
formulas for base object attributes. Auto-filling does not change the previously
filled formulas. Document attributes are matched with base object attributes
according to the attribute names, IDs and types.
Clicking the Clear Expressions button after request and confirmation clears all
formulas created both automatically and manually.
When formulas are created for a base object selected from the base object list,
they are retained in memory when a different base object is selected. So without
ending the wizard session, you can create "Create-on-basis" procedures for several
base documents. You can also resume editing the procedure for any base object by
selecting it in the list again.
To end your wizard session use the OK or Cancel buttons (with and without saving
your changes, respectively).
The Refresh button allows you to see your changes in the form module without
leaving the wizard window.
The wizard creates a Filling() procedure in the object module. The wizard
displays the following warning at the beginning of the procedure: This fragment
was built by the wizard. Warning! All manually made changes will be lost next time
you use the wizard.
The next time the wizard is used, all formulas previously generated for any base
document appear in the document attribute list when the corresponding base docu-
ment is selected in the base document list. The wizard makes formulas generated
in its previous session available for viewing and editing, both through the Fill
Expressions and manually. Moreover, it also takes formulas entered manually into
the document module into account if they are placed in the procedure it gener-
ates. The wizard does not check the correctness of these formulas. For example,
if filling with two different base document attributes is specified for a document
Chapter 26. Development Tools 2-987
attribute, the wizard selects one for display (by alphabet). This is the one that
remains in the module after the wizard results are updated. The second line corre-
sponding to the same attribute is deleted.
The selections available under Select form type depend on the type of object for
which the form is being created. The following forms can be created for the
Document configuration object:
document form
document list form
document selection form
generic form (blank form)
The number of forms for each type is unlimited. If the object has multiple forms
of the same type, you can choose one of them as the default form. When you open
an object without specifying explicitly which form to call, the default form opens.
2-988 1C:Enterprise 8.3. Developer Guide
To set a form as the default place a check mark in the Set form as default check
box in the wizard. The default form can be changed later, on the Forms tab in the
object editing dialog box (see page 1-59).
Selecting the Generic form type does not result in creation of a main attribute.
In this case the form behaves in the normal manner. Selecting another form type
results in creation of a main attribute and sets a different form type behavior.
These exceptions are defined in objects known as form extensions (see descrip-
tions of relevant object in the 1C:Enterprise script help).
Form type selection determines the main attribute type and consequently the entire
form behavior, including the available toolbar commands.
Specify the form name, synonym and comment.
The functions of the command bars are determined by the action source and type of
the form main attribute.
When the Finish button is hit, the wizard automatically places the controls in the
form and opens it for editing.
If form attributes have to be changed, click the Next > button. The attribute set
depends on the main form attribute.
The attributes to be placed in the form are chosen at this point in the wizard.
Selections are made in the Attributes column by checking the box to the left of the
entry.
IMPORTANT!
The form wizard does not include non-displayable attribute types (such as Val-
ueStorage) in the list.
Chapter 26. Development Tools 2-989
Executing this command opens the common form wizard that lists all system
constants as data and the current constant is the only selected attribute (by default).
This form is also auto-generated by the system if the constant has its Default Form
property non-filled and its Include in the command interface property filled.
To create an editing form for multiple constants create a common Constants form
first and then select the constants to be edited in the attribute selection page.
Constant forms belong to the command interface of the subsystems that own the
constant (if the Include in the command interface property is set for the constant)
and the common constant editing form (if the Include in the command interface
property is set for the common form).
If an editing form is created for the constant with the specified Include in the
command interface property, the common form wizard clears the Include in the
command interface property for the form. Therefore, the constant editing form
is only included in the command interfaces of the subsystems that own the
constant.
Selecting the Text document type assumes you use text documents specially
prepared as templates. For a text document, the Extension property is set to Text
template.
Selecting the Binary data type means that the configuration developer knows how
to work with this type of object.
Selecting the Active document type enables you to use the OLE active document
technology. If you press Finish, the wizard searches for available Active document
types and offers to select one of those it finds.
You can select a ready Active document and use it as a basis for template creation
(load template prototype from a file). If you have selected a file whose type is not
on the list of supported Active documents, the wizard displays a warning.
Selected document is saved in the configuration. Working with the template, you
must use properties and methods provided by the selected platform.
If you select the HTML document type, the HTML template editor opens.
This mode supports all features of the HTML editor. In addition, the HTML
template editor enables you to use pictures from the picture library, from a file,
from clipart or from "internal" pictures. Internal pictures are those already selected
from a picture file and stored "inside" the template.
To place a picture in a template, select Element – Picture.
To select a picture press the selection button. Select the required picture in the
window that opens.
The Geographical schema type allows you to create templates using documents
prepared with the geographical schema editor.
If the Graphical schema type is selected, the user can use graphical schemas
prepared in the graphical schema editor or load schemas from files and use them
as templates.
Selecting the Data composition schema type opens the data composition schema
wizard (see page 1-547).
If the Data composition appearance template type is selected, the appearance
template wizard window appears (see page 1-622).
Controls for selecting the presentation format are located on three tabs, according
to the data types:
number
date
logical values
Language (Country) field (L parameter) defines information presentation based on
the regional settings. Values specified in the following tabs override the country
settings.
Select the Number tab for numbers.
Length field (ND parameter) specifies the total number of decimal places (for the
integer and fractional parts). Precision field (NFD parameter) states the number of
decimal places in the fractional part.
Shift field (NS parameter) specifies the digit shift. A positive value results in divi-
sion by 10 to the corresponding power and multiplication is performed if negative.
Decimal separator field (NDS parameter) specifies the decimal separator.
Thousands separator field (NGS parameter) specifies the thousands separator. When
separator is set to an empty string, non-breaking space is used as a separator.
Grouping field (NG parameter) specifies the option for grouping digits in the integer
part of a number.
Zero presentation field (NZ parameter) is used to select how zero values are repre-
sented. This parameter can be used in a format string, but it is not used for text
boxes.
2-994 1C:Enterprise 8.3. Developer Guide
The date presentation option is selected in the Date format field (DF parameter).
The local date presentation option is selected in the Local date format field (DLF
parameter). DD parameter value is not allowed for text boxes.
Empty date presentation field (DE parameter) is used to select an empty date pres-
entation option. This parameter can be used in a format string, but it is not used
for text boxes.
TIP
The bottom part of the wizard window displays format string results (Example
group) and the format string itself.
For Boolean type data select the Boolean tab (see fig. 381).
If a value is not selected, default settings are used.
For details on format string parameters see a description of the Format String
parameter for the Format() method in the 1C:Enterprise script description.
Chapter 26. Development Tools 2-995
If the format string wizard is used, the generated format string is inserted into the
text (or text box) when clicking OK.
TIP
The text editor can be used to place the cursor in the format string and edit it by
selecting Text – Format String Wizard in the menu.
You can use the wizard to easily create the Source Line parameter for the global
context function NStr().
To open the wizard place the cursor over the required module area and choose
Text – Multilingual string wizard. The editor analyzes the module text where the
cursor is located and, if the construct is found, opens the wizard window. If the
construct is not found, the wizard informs the user about it (see fig. 382).
The wizard window contains as many text boxes as there are languages in the
configuration.
Enter the text and press the OK button. The wizard produces the following string:
ru = 'Доброе утро!'; en = 'Good Morning!'
2-996 1C:Enterprise 8.3. Developer Guide
26.17.2. Template
Templates can be created in the template wizard (see page 2-990) and the query
wizard with result processing (see page 2-979).
Information in the cells of final spreadsheet documents is transformed to String
type.
Chapter 26. Development Tools 2-999
Parameter – the name of parameter for cell contents. This property is displayed
if the Values category contains the Contains Value property or when the FillType
property of the Template category has the Parameter value.
Details Parameter – specifies the parameter for processing cell value details.
It is reasonable to use this property when the resulting spreadsheet document
is located in a form (Spreadsheet Document Field control).
When a finished spreadsheet document is opened in the Read Only mode and the
mouse is moved over a cell with the Details Parameter property filled, the mouse
pointer can appear as shown on fig. 385. (Hyperlink type cursor is only displayed if the
Hyperlink property is set for a hyperlink cell). It means that you may view the detail
of a spreadsheet document. Now, if you double-click this cell (or make it active and
press Enter or simply click it if it is a hyperlink), the field value is displayed:
String, Number, Date and Enum values are opened for viewing;
for Document values corresponding documents are opened for viewing and
editing;
if a value is a catalog item, this item is opened for viewing and editing in a
dialog box. If editing in the list is turned on in catalog properties, a catalog
list form is opened and the spreadsheet field pointer is moved to the required
catalog item.
This is standard detail processing that does not require any additional settings.
If you want special details processing, specify the name of the handler procedure
for the cell for the Detail Processing event in the Events category of spreadsheet
document properties. Describe drill down processing in the form module in this
procedure using the 1C:Enterprise script.
Review the following example. A form and PrintTemplate template have been
created for a report. The template includes Title, Header, GoodsHeader and Goods
named areas. The Goods area contains a cell which has a details parameter named
Detail The form contains the Table form element associated with the Spread-
sheet form attribute of the SpreadsheetDocument type. The Detail Processing
property in the Events category refers to the cell selection processing procedure
named DetailProcessingResult() located in the report module.
2-1000 1C:Enterprise 8.3. Developer Guide
Template = Documents.GoodsConsumption.GetTemplate("PrintTemplate");
// Header
Area = Template.GetArea("Title");
Spreadsheet.Output(Area);
// Header
Header = Template.GetArea("Header");
Header.Parameters.Fill(ThisObject);
Spreadsheet.Put(Header);
// Goods
Area = Template.GetArea("GoodsHeader");
Spreadsheet.Put(Area);
GoodsArea = Template.GetArea("Goods");
GoodsArea.Parameters.Fill(CurRowGoods);
Spreadsheet.Put(GoodsArea);
EndDo;
DetailsType = TypeOf(Details);
If Detailstype = Type("CatalogRef.Nomenclature")
Then
ReportFormName = "ReportForm1";
Else
ReportFormName = "ReportForm2";
EndIf;
ReportForm = DataProcessorObject.GetForm(ReportFormName);
ReportForm.ExecuteReport(Details, PeriodFrom, PeriodTo);
ReportForm.Open();
EndProcedure
Drill Down Use – specifies the drill down use area. If a cell is selected, drill down
are shown for the current cell only; if a row is selected, drill down are shown for
all cells in the current row. If DontUse is selected, no drill down are shown in any
case: the pointer does not change its appearance (for possible cursor types see fig.
384) and cell selection is not processed.
Values Property Category
Contains Value – if this option is turned on, a cell contains a value. This property
influences the properties of other categories.
Value Type – type of cell value. For spreadsheet documents, this list contains
Number, String, Date and Boolean types. For Spreadsheet document field form
element, the list also contains types defined for the current configuration, including
documents, catalogs, enumerations and others, in addition to primitive types.
The Arbitrary data type may be added as well. This data type may be deter-
mined with 1C:Enterprise script tools during form filling.
Control – a control may be selected for editing cell contents. The list of possible
values depends on the selected content type. For example, if Number data type
is selected, Text box or Checkbox may be used as an editor. A row with the editor
type Text box or Checkbox is added to the object list (Cells, Spreadsheet Docu-
ment) for the specified editor type. Contents of the properties palette for this object
depends on the type of selected control.
Format – format string to be used for displaying the value. If the display format
is not configured, it is selected from the infobase regional settings.
Editing format – a format line that will be used for displaying the value is speci-
fied. If the image format is not configured, the format is selected from infobase
regional settings.
Format can be entered manually or using the format string editor (see page 2-992).
NOTE
When a spreadsheet document is edited in a thin client, the following cell prop-
erties are not available: Contains Value, Value Type, Control, Editing format.
The overall procedure for working with a spreadsheet document in the data input
mode looks like the following:
Spreadsheet document template is generated; it is prepared in a special way
and used to input data.
A form that will contain a Spreadsheet document field field for data input
is generated.
Spreadsheet document field form element handlers that will process user-
entered data (when necessary) are generated.
Let us review the steps listed above using generation of a goods delivery form
based on the GoodsDelivery document. The target form is demonstrated on fig.
386. In this form, underlined fields are to be filled in by the user. Delivery date
field value is automatically calculated by summing up Issue date and Delivery
period values. Issue date is the document date.
Then the required structure must be created for the document to be generated.
Create the required fields:
Delivery address. Merge several cells and define the following properties:
○○ Name – ShipToAddress
○○ Protection – False
○○ Contains Value – True
○○ Value Type – String
○○ Control – Text box
Delivery period. Define the following properties for the cell:
○○ Name – DeliveryTime
○○ Protection – False
○○ Contains Value – True
○○ Value Type – Number, length: 3, precision: 0, non-negative
○○ Control – Text box
Delivery date. Define the following properties for the cell:
○○ Name – DeliveryDate
○○ Protection – False
○○ Contains Value – True
○○ Value Type – Date, date content: Date
○○ Control – Text box
Issue date. Define the following properties for the cell:
○○ Name – IssueDate
○○ Protection – True
○○ Contains Value – True
○○ Value Type – Date, date content: Date
○○ Control – Text box
○○ Format – DLF=DD
The resulting spreadsheet document should look as shown on fig. 387.
The Show Named Cells mode is enabled for the template (to do this, select Table –
Names – Show Named Cells in the menu).
2-1004 1C:Enterprise 8.3. Developer Guide
NOTE
Properties that can be set for the text box in the template are neither saved nor
used by the system to generate text boxes in spreadsheet documents in the data
input mode.
EndProcedure
&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
EndProcedure
&AtClient
Procedure OnOpen(Cancel)
EndProcedure
The resulting form filled with data looks like the following:
&AtClient
Procedure SpreadsheetDocumentOnChangeAreaContent(Item, Area)
EndIf
EndProcedure
flowcharts where some of the lines entering the join don't come out of the corre-
sponding splitting point;
flowcharts where parallel branches (coming out of the splitting point) enter the
same route points (before the join);
flowcharts with a cycle that do not contain any points of Activity, SubBusi-
nessProcess Point or Data processor Point type;
flowcharts where any route point of Condition Point or Switch type has no event
handler (ConditionCheck() or Switch(), respectively).
The procedures are created in the business process module which contains the edit-
able flowchart as a property.
When you work with a business process and a certain event occurs, program
execution control is passed on to a procedure that is linked to this event.
For a list of flowchart events or items along with conditions that invoke them, see
a description of the relevant object in the 1C:Enterprise script help.
26.18.3.3. Activity
Activity items in a flowchart are used to display the main points of a business
process that are used to assign and execute tasks.
Addressing Property Category
Explanation – a line that contains additional characteristics of the activity.
It is used when addressing attributes are inserted by the 1C:Enterprise script and
not predetermined during flowchart design.
Group – if this option is set to True, all tasks for this business process point are
issued to all group (department) members. Otherwise, one task is assigned to the
entire group, e.g., Sales Department and only one person (the first who undertakes
it) shall execute this task.
Addressing attributes – the number of these properties equals the number of
addressing attributes for a task selected in the Task property of the current busi-
Chapter 26. Development Tools 2-1011
ness process. You can use the properties palette to select one of the predefined
values of the type specified in the addressing attribute of the task (e.g., from the
Departments or Performers catalog).
26.18.3.8. Join
Join item of a flowchart map contains a business process point where all parallel
paths going out of the Spliting Point join. Until the task execution for all parallel
paths arrives at the join point, no transfer to the point beyond the join point
is executed. One splitting point always corresponds to one join point (although the
opposite is not true; hence, there can be splitting points with no join points). You
do not have to specify explicitly which Spliting Point item corresponds to the Join
item. The system determines it automatically.
2-1012 1C:Enterprise 8.3. Developer Guide
26.18.3.11. Switch
Switch flowchart item contains a business process point with several exits (vari-
ants), one of which is selected on the basis of the Variant parameter value of the
SwitchProcessing() handler.
26.18.4. Module
Flowcharts have no modules of their own. Event handlers are placed in the busi-
ness process object module.
To edit a picture stored in a file on the local hard drive, select File – Open and
then select the necessary file from the list.
The editor has two modes of operation: picture editing and picture collection
editing. The difference between picture and picture collections editing is purely
conventional. A picture collection is a picture consisting of multiple picture items
of the same size. Any picture can be saved as a picture collection. For example,
a picture collection can be used to store and edit pictures with similar application,
like icons, button pictures, etc. The picture-editing mode is a default mode of the
editor.
Editing methods are independent of the selected picture type (see page 2-1013).
For details on how picture collections work see page 2-1016.
The editor window consists of a toolbar, two panels (the preview panel on the left
hand side and the editing panel with the magnified picture on the right hand side)
and a color palette where you can select colors.
2-1014 1C:Enterprise 8.3. Developer Guide
The picture can be edited in both panels. Editing is done using the mouse. First
you should select a painting tool or a shape (pencil, brush, airbrush, rectangle or
ellipse) and a color using the color palette.
The status bar shows the current position of the mouse pointer as well as the scale
of the image.
A picture is a rectangle consisting of a grid of dots (pixels) that you can resize
by dragging the handle on the lower or right border or in the lower right corner.
A picture can also be resized using the Picture Settings window (see below).
Editing consists of setting the color of each dot in the picture. The number of
colors is defined by the picture resolution. The larger resolution is, the more
colors can be used.
IMPORTANT!
Using 24-bit resolution for large pictures leads to an increase in the configuration
size.
Color selection is made separately for each mouse button in the color palette.
The selected color is outlined by a double frame.
Each color can be modified. To do so, double-click the color you want to modify.
In the window that appears, select the color you need form color swatches or create
a new one.
Picture size can be changed. Dragging a handle located on the sides or the corner
of the picture area is just enough to achieve this task.
The grid (of pixels) is designed to simplify picture editing. The grid is formed
with dotted lines. To setup grid display select Actions – Grid. The following dialog
will open:
If the Pixel grid check box is checked, the pixel grid is displayed.
If the Image grid check box is checked, the program handles the picture as
a picture collection consisting of pictures of the same size (picture collection
editing is discussed in the next section). In this case collection item size selection
fields become active. Besides the pixel grid, a collection grid is displayed in the
picture editing field consisting of thin solid lines. However, the editing mode stays
the same.
Chapter 26. Development Tools 2-1015
If the Image grid check box is checked, the picture resize step is equal to a cell
size. If this check box is unchecked, the picture is resized by one pixel.
Various tools and the set of shapes are used for drawing. The set of tools and the
way they are used is similar to the standard tools used in Paint, an integral part of
Microsoft Windows. The shortcut table for the picture editor can be found in the
Help menu.
However, there are some differences. By using the Scale button you can scale the
image from 1:1 to 20:1 in a six step operation. By clicking the button you select
the next scale step. If you reach the 20:1 scale, the next time you click this button
the image is returned to the original scale, 1:1. The necessary scale can be selected
at once by clicking the scale selection button with a small triangle pointed down-
ward, located to the right of the scale button.
Clicking Scale and dragging the mouse pointer over any picture area causes the
frame to appear. The latter indicates the picture area to be displayed when the user
clicks the mouse.
You can also change the scale by holding down the Ctrl key and scrolling your
mouse scroll.
Shape buttons (rectangle, rounded rectangle and ellipse) also have selection buttons
and by using them you can select the shape type (common, outlined and filled or
filled).
Clicking the Picture parameters button opens the following dialog box:
The picture size and resolution (the maximum number of colors) are set in this
dialog. Alpha channel cannot be used for pictures with 1-, 4- or 8-bit resolution.
Only one transparent color is allowed. Alpha channel can be used if resolution
is higher than 8 bit.
NOTE
It is not recommended to use alpha channel for pictures that are bigger than
40000 pixels in size (e.g., 200х200 pixels). The web client operating in Micro-
soft Internet Explorer 6.0 cannot render these pictures correctly. This rule does
not apply to picture collections with items smaller than the size mentioned above.
The picture editor supports standard clipboard commands. Use Ctrl + V to paste
a picture, Ctrl + C to copy it and Ctrl + X to cut (copy and delete). If the picture
size is larger than the current dimensions, the editor suggests that you change the
current dimensions.
2-1016 1C:Enterprise 8.3. Developer Guide
The toolbar contains a button that changes its purpose depending on the selected
tool or shape. It is located in the second row to the right next to the Picture param-
eters button. When the line or freehand tool, rectangle or ellipse shape is selected,
this button indicates thickness of the line used to draw the shape in pixels. By
clicking this button you can modify the thickness (five steps). By clicking the selec-
tion button you open the pop-up menu where you can select the thickness you need.
This button sets the size of the airbrush, the size and shape of the brush and the
size of the eraser. When a selection or text tool is active, this button allows you to
set the transparency mode.
Click the Text button to enter text. The following dialog box is displayed:
Enter the text in the multiline text field. The font family, size and other attributes
are set using the Font button. The font family is selected from the list of system
fonts or from the styles defined in the configuration.
By using the Replace Colors button you can easily change the font color selected
by the mouse pointer on the color set for the given mouse key. In this fashion you
can quickly change the drawing color using two colors per mouse key.
In the Picture Settings item group, the cell (picture) parameters are set. In the
Collection Options item group, cell size in pixels (dots) are set.
A picture collection can also be edited as a common picture. If you do this,
it is recommended that you setup the image grid first (see page 2-1013).
Tables can be nested. To add a nested table create a new table in a cell of the
existing table.
If the picture has to be placed in a border, enter border width in the Border width
dialog box attribute. If the width is not defined or equals 0, then the border is not
displayed. Click OK to insert the picture. Attributes specified in the dialog box can
be changed using the picture properties palette.
Inserted pictures can be moved. To do this, point to the picture and drag it to the
correct place in the document. The Position picture property does not change
in this case; for example, if neither Left nor Right is set up, the picture can be
added to the text, otherwise the picture is placed in a new row.
Pictures can be copied. Copy operations are standard (through the clipboard or
using the mouse with the Ctrl key held down).
Pictures can be placed anywhere in HTML documents (text, table or label).
26.20.1.4. Marquee
Marquee is a special object of HTML documents. It is an area where text, a table,
a picture or other labels can be placed. When a label is displayed, nested objects
scroll continuously from right to left.
To insert a label select the Element – Marquee command.
Labels can be resized. To do this, select a label and move its marker with the
mouse.
Labels can be placed in a text and a table.
26.20.1.5. Hyperlink
HTML documents support creation of links for hypertexts.
Select a text or a picture object and go to Element – Link. The link creation dialog
box appears on the screen (see fig. 397).
Specify the following in the URL attribute:
hyperlink path;
reference to help information about the configuration object;
reference to the system help section. If Managed application is selected as the
configuration editing mode, only help sections associated with managed appli-
cations are displayed (along with the column that describes availability of these
sections in the web client). If Managed application and ordinary application
is selected as the configuration editing mode, all help sections are displayed
with information about their availability in managed applications, web clients
and ordinary applications;
tab name (preceded by the "#" character).
2-1020 1C:Enterprise 8.3. Developer Guide
26.20.1.6. Bookmark
You can create bookmarks for internal references within the current HTML docu-
ment. To do this, select a text or picture object and go to Elements – Bookmark.
Dialog box for bookmark name entry appears on the screen. The selected object
is not formatted now.
Bookmarks are used to organize internal links.
26.20.1.7. Line
Lines can help organize a document visually.
it is encoded using UTF-8 with the unchanged charset tag, which is set to
UTF-8 when the document is read.
On the Configurations tab, you can select configuration objects for editing interface
texts.
2-1022 1C:Enterprise 8.3. Developer Guide
The configuration list includes all open configuration windows (in addition to the
main configuration, these can include database configuration, configuration files,
repository configuration and vendor configuration).
You can select Entire configuration to create a full list of configuration objects
containing interface properties. You can perform search only for specific objects if
you select this object in the combo box.
Use the Files tab to select text and spreadsheet documents as well as external data
processor stored in files.
Check the Search in NStr functions in modules option on the Modules tab if you
need to determine where the NStr() operator is used in modules.
To remember the search parameters (the list of configuration objects, files and open
documents), specify a name for the current settings in the Search domain attribute.
When you reopen the search window, you just have to select the area you need
from the list and perform your search.
Select the objects you need and click Find. The following window is displayed:
The window contains a table box. The first column of this box shows the location
of the found text. Other columns are usually used for other languages. The table
Chapter 26. Development Tools 2-1023
box can have more columns than the number of languages specified. Additional
columns appear when new Language objects are created in the configuration
process and then they are deleted or their language code is changed (when the
language code is deleted or changed, the Designer does not reset the interface text
for these languages).
Table box content is sorted by the contents of one of the columns. Click a column
header to change the sort order. Clicking the header again changes the sort direction.
Text can be edited directly in cells. To do so, select a cell and press Enter.
Text box opens in the edit mode. Enter the text you want and press Enter again.
The modified text is shown in red.
For quick access to the interface text for a specific object, double-click the required
line in the Arrange column. A form with this text is displayed. You can also view
and replace the found text in the properties palette. If text has been modified
outside the editing window, you can refresh the table box.
Above the table box, there are controls for performing various actions and window
setup.
Use the Collapse combo box to specify the text collapse mode for different
languages. If this option is set to None, the text is not collapsed. If this option
is set to Matching in sort language, all items with the same text in a sorting
column are collapsed. The first column contains the group mark (+) which can be
used to expand the group. The first column also contains the <Prefixes: N> text
(where N is the number of item occurrences). If other columns of this group have
different text values, cells in these columns contain <Different values> text.
If this option is set to Matching in all languages, all items with the same text are
collapsed.
You can perform mass replacement for text in collapsed rows. To do so, enter this
text into a cell for the appropriate language as if it were one string. This text will
replace the text in all rows of a group.
Use Actions – New search to open the setup window for configuration sections to
be searched.
Use Actions – Copy texts to copy all texts in one language to a different language.
It is recommended to use this operation only when words and phrases in different
languages are similar to each other.
Actions – Clear texts clears all texts in the selected language.
Use Actions – Fill texts to translate synonyms, headers, tooltips and interface texts
quickly using a matching file. This represents a spreadsheet document with
several columns (according to the number of languages used).
The first row of each column contains a language code (for example, en or de).
Other rows contain matching samples. There are no requirements to sorting
(ordering) rows. Rows can be duplicated.
2-1024 1C:Enterprise 8.3. Developer Guide
After selecting the matching file specify the default language (By language) and the
languages of the translation (To languages). Setting the Only fill unfilled check box
locks rewriting already localized rows.
Select the key language and languages for filling from the languages discovered
during the interface text search. All languages selected for filling must be specified
in the matching file (it must contain columns with headings corresponding to the
codes of these languages).
NOTE
If you see rows in only one language when you open the Edit interface texts win-
dow, the Fill texts command becomes unavailable.
Fill interface texts by pressing OK. Texts are filled not only performing a check
for matching to the language used as a basis for the loading, but for matching to all
languages available in the text matching file.
This allows you to insert different rows in one language as a match to identical
rows in another language. You can create a secondary language in the bilingual
configuration to comment on the interface texts and provide different comments
to homonyms in the default language. For example, two Account strings can have
different comments: financial term and user account. Then, when the interface texts
are filled from a file, you can match them with different words.
Use the Actions – Export to spreadsheet command to move the contents of a table
box to a spreadsheet document. When you execute this command, only unique
rows are displayed.
Use the Actions – Settings command to set up a table box view and editor opening
mode for mass replacement.
Chapter 26. Development Tools 2-1025
The Button position group is used to select a mode for column placement:
Horizontally – as shown on fig. 401.
Combined – columns are placed one below the other.
Combined, with selection of sort language – this option places columns as
follows: to the right of the Arrange column you will see the column with the
current language of sorting and further to the right there will be columns with
other languages. When you click the header of a column, the list is sorted
by this column and it is moved to the left of the Arrange column. A column
for sorting replaces the selected column. If there are only two languages, the
columns will simply change places.
If the Show as tree on collapse option is checked, you can access collapsed rows
and collapsed groups are shown as a tree.
It is recommended not to check the Open editors on change option if there are
many entries.
If the Show edited strings in contrasting color option is checked, the text in modi-
fied rows is shown in another color.
Since there are quite a lot of operating modes, validations are divided into two
groups:
A group of validations available for forced and automatic check when the
configuration is edited. These modes are available for selection in the
Modules – Check settings configuration dialog of the Designer (see page 1-159).
The whole list of validations that can be called for a central configuration check
(described mode).
Further, we describe which preprocessor instructions will be defined for every
validation mode, mode specifics (if any) and validation modes that are not related
to determination of the environment of the executed source code.
General Options
Thin Client
It checks the module compilation while checking the thin client environment
in the managed application mode (executed in the file mode).
Web Client
It checks the module compilation while checking the web client environment
in the managed application mode (executed in the file mode).
Server
It checks the module compilation in the 1C:Enterprise server environment
check mode. The following preprocessor instructions are defined: Server.
External connection
It checks the module compilation in the external connection environment check
mode (executed in the file mode version). The following preprocessor instruc-
tions are defined: ExternalConnection.
External connection (client/server mode)
It checks the module compilation in the external connection environment check
mode (executed in the client/server mode).
Mobile application - client
Module compilation is checked in the environment check mode for the client
application running on the mobile platform.
The following preprocessor instructions are defined: Client, AtClient,
MobileAppClient.
If the Use ordinary forms in managed application configuration property is set
to False ordinary form modules are not checked when this test is selected.
The following preprocessor instructions are defined: Client, ThickClientMa-
nagedApplication, Server.
Thick client (managed application, client/server mode)
It checks the module compilation in the managed client environment check
mode (executed in the client/server mode).
If the Use ordinary forms in managed application configuration property is set
to False ordinary form modules are not checked when this test is selected.
The following preprocessor instructions are defined: Client, ThickClientMa-
nagedApplication.
Modules shipped without source texts
If the configuration distribution settings for some modules specify transfer
without source texts, it checks whether module images can be generated.
Logical module check
If the Use managed forms in ordinary application configuration property is set
to False, managed form and command modules are not checked when this test
is selected. The form module specified in the Default Constants Form property
is tested at the time this test is selected regardless of the Use managed forms
in ordinary application property value.
The following preprocessor instructions are defined: Client, ThickClientMa-
nagedApplication, Server.
Interactive actions are recorded for thick and thin clients and are not recorded for
web clients.
For details on logui.txt file format see "1C:Enterprise 8.3. Administrator Guide".
2-1032 1C:Enterprise 8.3. Developer Guide
Chapter 27
Debugging is a step in the application solution development process. It involves
finding, isolating and eliminating application errors.
Debugging can include using a debugger (see page 2-1033), performance meas-
urement results (see page 2-1052), output of server calls (see page 2-1057) and
limitation of delays for server calls (see page 2-1057). You can also run the auto-
mated testing scenario (see page 2-1060).
This chapter describes platform tools that can be used for application debugging
and testing.
27.1. DEBUGGER
Debugger is a tool that facilitates program module development and debugging
in 1C:Enterprise. Debugger has the following features:
debug module execution (in both file mode and client/server modes) and back-
ground jobs. Client modules of web clients cannot be debugged;
execute module step-by-step;
set breakpoints;
interrupt and resume module execution;
debug multiple modules at once;
calculate expressions for variable status analysis;
view procedure and function call stack;
abort upon error;
edit module during debugging.
2-1034 1C:Enterprise 8.3. Developer Guide
Debugger uses debug items. A debug item is 1C:Enterprise script context with
a set of parameters:
name of the user executing 1C:Enterprise script code;
debug item type;
name of the machine used to execute 1C:Enterprise script code;
number of the used session;
number of the IP port used by the debugger to control the debug item.
NOTE
In the client/server version, if there are multiple workflows in a cluster and
a session was redirected to another workflow in the process of debugging web
client or server code, debugging is impossible. For details on sessions, see the
"1C:Enterprise 8.3. Client/Server. Administrator Guide".
Debug items can have the following types:
Thin client – 1C:Enterprise script code executed at the thin client;
Server – 1C:Enterprise script code executed on the server;
Server (file mode version) – 1C:Enterprise script code executed on the server
in file mode version;
COM-connection – 1C:Enterprise script code executed through an external
connection;
Web-service – 1C:Enterprise script code that handles Web-service method
calls;
Background job – 1C:Enterprise script code that handles background jobs;
Thick client – 1C:Enterprise script code executed at the thick client;
The debugger and debug items use IP-address 127.0.0.1 when they search for each
other.
To ensure stable operation of data transport service map address 127.0.0.1
to symbolic name localhost. The following mapping can be written to the file
C:\Windows\system32\drivers\etc\hosts:
127.0.0.1 localhost
DNS-server is used when computer name specified in the Debugging Items dialog
box and used to search for debug items is not represented as an IP-address or
when debugger specified in XML files for debug settings of COM-connections
and Web services is not represented as an IP-address. In other words, debugger
URL is used for COM-connections and Web services as it is written in the file.
If computer name is written instead of IP-address, DNS-server is still called.
To enable debugging you need to enable 1560 – 1591 port range (default) on
the computer where the Designer is installed and on computers where debug-
ging objects being used are located. If another port range is selected using the
debugcfg.xml file (see page 2-1042), you need to allow usage of the new port range.
Moreover, this port range should be specified on all computers where debugging
objects are located (except server debugging objects that use the port range set
in the 1C:Enterprise server configuration).
If ports required for the debugger are not permitted to be used on the computer
where Designer is installed, debugging is not available on that computer and the
following may occur:
Starting time of the client application increases.
1C:Enterprise server workflow slows down, if the server uses the debugging
mode (-debug switch).
box). Please keep in mind that you cannot uncheck this check box after you
apply the settings.
If the 1C:Enterprise mode is launched and you need to enable debugging for
the next launch, open the settings form (select Tools – Options), and check the
Allow Debug debugging on startup check box.
For more details on the default.vrd file, see the "1С:Enterprise 8.3. Administrator
Guide".
2-1038 1C:Enterprise 8.3. Developer Guide
If the url attribute is specified for the debug item, the Designer should be available
at the specified URL when the web service is accessed. Otherwise, the web service
will be paused and the system will wait until the Designer becomes available. You
will need to connect the required debugging object to continue working in the
Designer.
If you need to debug a web service in the client/server version of an infobase, you
should enable the debugging mode on the server using the debug command line
switch. For more details on 1C:Enterprise startup command line switches, see the
"1С:Enterprise 8.3. Сlient/Server. Administrator Guide".
Open the infobase in the 1C:Enterprise mode by using the debug and
debuggerurl="ip address" command line key.
http://localhost/demo?debug&debuggerurl="127.0.0.1"
ip address is the debugger address. In this case the debugger at 127.0.0.1 auto-
matically connects debugging objects (the debugger should have started at the
specified address).
If you need to enable debugging of the server side file mode version, you can use
two methods:
Start debugging directly in the Designer as described above. In this case the
debugging mode for the server side of the file mode infobase version located on
the web client computer is enabled automatically.
Enable the debugging mode using the default.vrd file that should be located in a
virtual application directory. You need to specify the debug item in this file,
otherwise if this item is not present, the web service can't be debugged.
Example of the "debug" item from the default.vrd file:
<debug enable="true" url="tcp://192.168.0.30"/>
Chapter 27. Debugging and Testing of Application Solutions 2-1039
You should also consider the fact that system performance is slower in the
debugging mode than in the normal mode. So it is not recommended to use
the debugging mode of the file mode server side in real user experience.
For more details on the default.vrd file, see the "1С:Enterprise 8.3. Administrator
Guide".
Note the following when debugging a web client:
The ability to interactively enable the debugging mode is not supported.
Automatic search of debugging objects on remote computers is not supported
when you are debugging a web client for a file mode infobase.
Activating the Designer from a debugged web client is not supported.
Debugging external reports and processes is not supported.
IMPORTANT!
To debug a web client (including client application code) in the client/server
version, the 1C:Enterprise server should be started in the debug mode (the debug
switch).
NOTE
It is not recommended to debug a web client in low-speed communication chan-
nels.
Debugging should be enabled in the application (for a server – the debug flag,
for a client application – the corresponding command line switch or a client
application settings dialog flag or a correctly configured configuration file).
Debugging items are available for connection during the session within which
a specific background job, web service or external connection is working.
This interval can be very short and in this case you can use automatic configura-
tion of the debugging items connection.
NOTE
When a debugging item is connected, the infobase user list should include users
on behalf of which authorization was performed both in the Designer and in the
debugging item.
Usually the list contains one line that refers to the configuration running in the
1C:Enterprise mode. If several 1C:Enterprise applications are running with this
configuration, the list may contain several lines.
If the Search for debugging items on remote computer check box is selected, enter
computer name or network address in the box to the right of the check box or select
it from the list of previously entered names. The debug items found on the remote
computer will be added to the available debug items list. The list of attached debug
items contains the items already attached to the debugger.
To connect the selected debug item to the debugger, press Attach. In the attach-
ment window, the debug item is moved from the available to the attached list.
To exclude debug item, select it in the list of attached items and press Detach.
In the attachment window, the debug item is moved from the attached to the
available list and you can attach it once again. At that moment, breakpoints set
in detached debug items do not function when execution passes through them.
To close a debug item press Break. To break execution press Stop.
Chapter 27. Debugging and Testing of Application Solutions 2-1041
To open range setup dialog box press Options. The range defines limits where the
debugger searches for debug items on the current or specified remote computer.
The Debugger field of the dialog box contains settings for the current debugger.
You can use them, for example, in command line during client application startup
as the /debuggerURL command line key parameter or in an XML file containing
debug settings for external connection or Web-service.
To set auto-attachment for debug items on the 1C:Enterprise server running in the
debug mode, use the Autoattach dialog box and select the required debug item
types.
27.1.2. Breakpoint
A breakpoint is a place in the program module where module execution stops
and control passes to the debugger.
The current breakpoint, break locations and breakpoint statuses are shown in the
left column of the module text, with special marks.
A breakpoint can be set on any line of the module at any time working with the
debugger. If the line with a breakpoint does not contain any operators (e.g., is an
empty line), contains non-executable text (e.g., procedure or function header,
variable declaration, etc.) or continues an operator that begins on previous lines,
Chapter 27. Debugging and Testing of Application Solutions 2-1043
breakpoint location is automatically adjusted. Breakpoint location is marked with
a special character in the left column of the module window. Different characters
are used for enabled and disabled breakpoints (see fig. 408).
The mouse can also be used to set or remove breakpoints. To do this, double-click
in the grey margin next to the line where you want to set the breakpoint.
Use the following commands on the Debug menu of the Designer (see table below)
to manage breakpoints.
Command Details
Breakpoint Set or remove a breakpoint on the line where the cursor is located
Conditional Breakpoint Set a breakpoint and open the dialog box for break condition entry (a logical
expression). If the condition has been entered, the command opens the
dialog box for condition editing. If a breakpoint has been set on this line, the
command opens the dialog box for breakpoint condition entry. Execution stops
at the specified breakpoint only if the condition is satisfied
Toggle Breakpoint Off Toggle breakpoint on/off. The command is available if the current line has
a breakpoint
Clear All Breakpoints Delete all previously set breakpoints in all modules
Disable All Breakpoints Disable all previously set breakpoints in all modules without deleting them
Breakpoint List View and manage breakpoints
Stop on Errors When an error is found, the debugger stops execution and moves to the
module line that has caused the error
Set breakpoints are saved when the configuration is closed. To view the list of
breakpoints open the configuration and use the Debug – Breakpoint List command.
Use check boxes in the On/Off column to manage the breakpoint state. If the check
box is selected, the debugger stops execution at the breakpoint.
For description of other buttons see fig. 409.
2-1044 1C:Enterprise 8.3. Developer Guide
When applications are debugged, you need to remember the following: if the
Execute() operator is used in the debugged code, then:
Step-by-step execution of the code passed as an operator parameter (including
procedure and function calls) is not supported.
Interruption of the program code is supported using breakpoints inside
procedures and functions called from the code, which was transfered as the
Execute() operator.
If you debug multiple debug items, you should remember about some step-by-step
execution features:
if you stop a debug item, other debug items are also stopped when you execute
the code;
if you select Continue, it results in resuming execution of all debug items;
if you select Step Over, it results in stepping to the next line for all debug
items;
if you select Step In (if the executable module operator calls a function or
a procedure), it results in stepping to the first operator in the call, while Step
Over command is performed for other debug items.
If you debug the client/server mode and the code is sequentially executed on the
client and the server (client and server debug items are attached), then:
if you select Step In (if the executable module operator calls a function or
a procedure on the server), it results in stepping to the first operator in the
call;
Chapter 27. Debugging and Testing of Application Solutions 2-1045
if you select Step Out or Step Over for the last executable operator (if the
executable module operator calls a function or a procedure executed on the
server and called from the module executed in the client application), it results
in stepping to the next executable operator in the call.
The current debug item can be selected in a special Debug Items toolbar. It has
a single combo box that displays the current debug item. The box is only acces-
sible when the debugger controls one of the attached debug items (e.g., after
a breakpoint is activated). The list of debug items only contains items that are
currently controlled by the debugger, including the current debug item.
Use the immediate window and the Expression dialog box to get values for the
relevant expressions. You may use the Call Stack to trace the sequence of proce-
dures and functions.
If you use step-by-step execution, the call stack and variable values (in the imme-
diate window and the Expression dialog box) are displayed for the current debug
item. When you change the debug item, it also changes the call stack and variable
values.
IMPORTANT!
If you attach the client and server debug items and move from the client to the
server, no calculations are performed at the client levels of the call stack. These
levels are highlighted in grey in the call stack window.
If you need to continue module execution, select Debug – Continue Debugging
to enable free module execution for the attached debug items (up to the next
breakpoint). If a client application is attached for debugging, it is activated auto-
matically.
If you want to end the entire debugging process (except background jobs), remove
all breakpoints from all modules and run the Debug – Continue Debugging
command if a breakpoint has been activated. If you need to abort debugging and
terminate the attached debug items, select Debug – Break. In the latter case Befo-
reExit() and OnExit() procedures are not executed.
You can edit the current configuration and save changes during debugging.
IMPORTANT!
Although a debugged module may be edited, the debugger does not compile the
modified code and debugging is continued for the database configuration code
(that existed at the moment when the debugger was launched or when the connec-
tion was opened). To debug changes made to the configuration you should update
the database configuration.
If you set the exclusive mode in the 1C:Enterprise mode, you will not be able to
save the current configuration until the exclusive mode is removed.
If a file mode infobase is executed step-by-step in 1C:Enterprise or it is in a
breakpoint and there is an open transaction (explicit or implicit), some oper-
2-1046 1C:Enterprise 8.3. Developer Guide
Enter an expression in the 1C:Enterprise script into the Expression field of this
window. You may enter an expression "manually" or select it from a list of previ-
ously entered expressions.
If the cursor in module window is placed over an expression or if an expression
is selected when you open the Expression window, this expression is automati-
cally entered into the Expression field.
Use the Evaluate button to calculate an expression. The expression evaluation
result is displayed in the Value field.
The Add to immediate window button places the expression into the immediate
window. This helps track expression changes during debugging. The expres-
sion is placed in a new line of the immediate window. The immediate window
is opened if it has not been opened yet.
If an expression has a String type or is a collection of values or an array, the
Show Values in Separate Window button becomes available.
The Evaluate Expression window is used for a more convenient view of long
lines. This window contains a control of Label type that displays the line value for
viewing.
To make it easier to view a collection of values or an array, a window containing
a table box is opened. Columns in this window correspond to attribute names
and rows contain attribute values. The window also shows the count of items in a
collection and the first column contains an index of each collection item.
If a specific value is also a collection of values or an array and a row, you may
view these values in a separate window (as shown on fig. 411). To do this, select
the required value and select the Show Values in Separate Window command from
the context menu or press the F2 key.
2-1048 1C:Enterprise 8.3. Developer Guide
A window with the line expression in a multi-line field will open. You may copy
this expression to the clipboard.
The contents of the calculation result from the table box can be output to a text or
spreadsheet document using the Output list button. If the calculated value is repre-
sented as a tree, you can only output data from the opened strings of this tree.
You may also view current value of the expression by moving the mouse over it.
The current value is shown as a tooltip near the variable. You may view it if
the value can be represented as text. In the same way, you may view the property
value. If the property is represented as <Object>.[<Object>. …]<Property>
(Example: FormElements.CommandBar.Buttons.Get.Enabled), you may view
its value by moving the mouse over the text. The value is displayed if the text
does not contain parentheses or square brackets. You may also view the value of
the array item that has an index (as a number or variable with a value specified at
the moment of viewing). To do this, you need to select the array ID and index.
When you move the mouse over an object or over a selected object or a group
of objects in <Object>.[<Object>. …]<Property> text, its type is displayed.
For example, if you select FormElements.CommandBar1 in text FormEle-
ments.CommandBar1.Buttons.Get.Enabled, CommandBar type is shown.
Chapter 27. Debugging and Testing of Application Solutions 2-1049
If you switch the context to the top of the stack (double click the row with the
yellow arrow), the value of VariableOnServer will be set to Recall, since the
context is switched.
Some rows in the Call Stack window are shown in grey (the last two rows in fig.
413). This means that you can switch to a module row, but you can't evaluate
expressions in the context of the called method. Thus those stack items are selected
that are "located" on the client, and the top of the stack is "located" on the server.
NOTE
Not available in a web client.
Define number of the session to be debugged. To do this, enable display of
the All functions command (select the Show "All functions" command check
box in the parameter setting window). Then open a list of active users (Main
Menu – All functions – Standard – Active users) and save Session column status
for the selected user (current user). The list of active users can only be viewed
by users with sufficient access rights.
Then use the Designer to open the infobase to be debugged (for details on
starting up various 1C:Enterprise modes see "1C:Enterprise 8.3. Administrator
Guide").
After this open the debug item attachment window (see page 2-1039) and attach
the debug item with the Session value equaling the Session value in the list of
active users (see above).
Now, breakpoints get activated in the attached debug item and program code can
be debugged.
If you do not want to include the startup section in the measurement, first launch
1C:Enterprise and prepare it for execution of the required part. Then switch to the
Designer and turn performance meter on.
If you want to include 1C:Enterprise shutdown section into measurement, you have
to exit 1C:Enterprise and switch to the Designer regardless of the option used to
start the measurement. In this case you do not have to stop the meter manually.
When measurement results are ready, they are displayed.
If you do not want to include the 1C:Enterprise shutdown section in the measure-
ment, it must be finished to view the measurement results. For example, if you
want to analyze the posting procedure for a document, run 1C:Enterprise, open the
document, fill it in, switch to the Designer mode, turn the meter on, then switch to
the 1C:Enterprise mode, post the document, switch to the Designer mode and end
the measurement.
Client – this icon (see fig. 414) marks code lines executed at the client;
Server – this icon (see fig. 414) marks code lines executed on the server;
Processing by server – these icons mark code lines that initiate server calls:
○○ server was called at the platform level or procedures and functions executed
on the server were called directly (Direct server call on fig. 414);
○○ local call of procedure/function executed on the client where the server call
was executed at the platform level or procedures/functions executed on the
server were called directly (Nested server call on fig. 414).
Execution time for each line in execution measurement results is made up of time
of operator line execution (net time) and of procedure (function) call time if they
are in the line. Use Include execution time for procedure and function calls check
box to select which time to indicate: full time (as a sum of call time and net time)
or net time of execution.
If the line contains at least one procedure (function) call, execution time contains
operator line execution and procedure (function) call time.
If the check box is selected, procedure (function) call time is included in the full
execution time.
If this check box is deselected, measurement results include only execution time
for code lines, but not execution time of procedure (function) that is called by
this line. In this case the total execution time for this line (in Time column) is not
the same as the actual time spent by the system in processing this line. Please
remember that execution of called procedure (function) may be time-consuming
and this time is not included in the result (net time).
The check box is selected by default and its state is recorded between sessions.
If the state is changed, names of time columns are also change.
Chapter 27. Debugging and Testing of Application Solutions 2-1055
If the Client check box is selected, results of code execution measurement on the
client are displayed.
If the Server check box is selected, results of code execution measurement on the
server are displayed.
If the Client and Server check boxes are selected, results of code execution meas-
urement on the client and on the server are displayed.
The check boxes are displayed only during server infobase debugging. The check
boxes are available only during server debug item debugging.
If there are several open windows with performance measurement results, when
you place the mouse pointer onto the results column, you can see a tooltip with the
URL of the file reflected in this column.
When you double click the mouse on the column with the performance measure-
ment results, the module editor moves to the appropriate string in the file with the
performance measurement results.
In addition to the special window, measurement results can also be viewed in the
module source code window. If a performance meter window is opened in the
debugger, the module windows contain a column that shows the total number of
calls for the current line and the percentage of its work in relation to the total time.
Icons are used to indicate code execution on the client or server as well as server
calls (similar to the measurement results window; for a description see fig. 414).
Double-click a line in the measurement results window to switch to the corre-
sponding line in module window.
If several measurements are opened at the same time, the module text windows will
contain the corresponding number of columns.
Close the measurement results window to remove the columns with the number of
calls and work time percentage from modules.
2-1056 1C:Enterprise 8.3. Developer Guide
A measurement file can be opened using the File – Open command. To filter meas-
urement files use the Performance analyzer (*.pff) filter.
NOTE
The maximum delay value can be 9.99 s. 0 means delay is not applied.
Server call delay imitation can also be enabled in the 1C:Enterprise mode. To do
this, use the Tools – Options dialog box. Setup of server call delay imitation in the
1C:Enterprise mode is only valid in the current session and is not preserved.
Performance display can also be enabled in the 1C:Enterprise mode by selecting
the Show performance indicators check box in the Tools – Options dialog box.
By default the mechanism is disabled.
If this mode is enabled, 1C:Enterprise displays performance indicators in the
performance indicator panel at the bottom of the main application window.
If the delay simulation mode is enabled when a server is called, the picture in the
window showing server calls will look differently.
If you have not yet opened or have already closed the main application window of
an applied solution, the performance indicator window looks like this:
If the server delay simulation mode is enabled, the performance indicator window
looks like this:
The current server call status (in progress, completed, none) is displayed as an icon
in the top left corner of the window. Size and position of the performance indica-
tors window are saved between the sessions.
Chapter 27. Debugging and Testing of Application Solutions 2-1059
When data displayed in the server call window is changed, it is highlighted with
red color.
By default the window displays two counters, Current сalls and Accumulated calls:
Current calls – shows statistics of server calls since a certain point in time:
engine start time or the last user action not followed by any other user action
within 0.2 s.
Accumulated calls – shows statistics of the server calls since the engine start or
its last forced reset triggered from the context menu.
This is done using the Performance indicator settings. You can open this dialog by
clicking the button in the performance indicator panel and selecting Settings in the
menu.
You can specify the following parameters in the settings dialog:
Periodicity group – indicates the period to display counter values for;
Indicators group – defines which indicators are to be displayed in counters.
The context menu of this window also includes the following commands:
Clear accumulated – clears the accumulated calls counter.
History of current – opens the history window for the current calls counter.
2-1060 1C:Enterprise 8.3. Developer Guide
History of the accumulated – opens the history window for the accumulated
calls counter.
The settings are shared by all users and all infobases of the current computer.
Setup of server call display window in the 1C:Enterprise mode is only valid in the
current session and is not preserved.
The user should be aware of the following peculiarities of this mechanism:
In the file mode version (direct infobase connection) the amount of data
is displayed without compression as compression is not used in this case.
In the client/server or file mode version with Web server connection or in the
SDC traffic compression mode, indicator values can be affected by actions
sequences since previously transferred data are used in compression.
This mechanism has peculiar features in the web client:
Only synchronous calls are taken into account.
The amount of transferred data is displayed in characters instead of bytes.
Measurement results can be used to compare various call options in the web
client; it is not recommended to use the results to compare the amount of trans-
ferred data for different client types.
Performance indicators are only displayed after the main application window
opens, and indicator values add up. After the main application window
is displayed, you can see the relevant results from running the web client.
The indicators window is bigger than in other clients and does not appear on
top of other windows.
Two systems participate in the testing process: the testing manager and testing
client. The testing manager handles the following:
Connection to the testing client in order to run the testing scenario (test connection)
Execution of the testing scenario
Evaluation of test results (if necessary)
The testing client handles the following:
Execution of testing scenario commands received from the testing manager
Transfer of data required for test results evaluation to the testing manager
You can use the thick or thin client as the testing manager, and you can use the
thick, thin or web client as the testing client. A single testing manager can be simul-
taneously connected to multiple testing clients, whereas a testing client can only
be connected to one testing manager. The testing manager and the testing client
communicate using a direct TCP/IP connection via a specific port (that has to
be open). The testing manager and the testing client represented by a web client
communicate via the 1C:Enterprise server (for client-server version of the tested
application) or a web server (for file mode version). Testing does not require any
changes to be made to the tested application.
The testing scenario can be stored either in the tested applied solution or in a
separate applied solution. It does not affect how the testing manager and the testing
client communicate.
Please note that the testing manager (and the testing scenario you execute) has
no direct access to the tested application. In other words, the testing scenario can
access all features of the application where the scenario is run (testing manager) as
well as the logical model of the tested application interface and forms.
If you launch a client application in the testing client mode, it does not affect
its performance nor any other characteristics; however, any testing manager can
connect to this application if it knows the computer name (or IP-address) and the
port used for communication.
The system also allows you to write interactive user actions to an XML file. You
can use this file later for automated testing. To write this file, you should launch the
tested application in a special run mode. You can also manage interactive action
write operations via the 1C:Enterprise script.
In this example, the thin client (1cv8c) is used as the testing client for the Test
Application infobase, and TCP-port 1843 is used for communicating with the
testing manager.
Therefore, if you want to connect to the testing client represented by the thin or
thick client, you should know two parameters: the IP-address (or computer name)
where the testing client is running, and number of the TCP-port to be used for
communicating.
Running a web client is a little more complicated. In addition to the
TestClient option, you should specify another startup command-line option: the
TestClientID<ID> that contains a unique identifier for the tested client applica-
tion. If the web client is used, unique identification of the testing client requires
three parameters:
Address of the web server where the tested application is deployed. You do not
have to know the infobase address.
The number of the TCP-port to be used by the web server to transfer data
between the testing manager and the testing client.
The identifier of a specific instance of the tested application running on the
web client.
In other words, a single web server can work with multiple infobases and with
multiple connections to a single infobase (also for testing purposes), but for
the web server you have to specify which TCP-ports are to be used for commu-
nicating with the testing manager. You can do this in the testcfg.xml file stored
in the web server extension settings directory. For details about this file, see
"1C:Enterprise 8.3. Administrator Manual".
Chapter 27. Debugging and Testing of Application Solutions 2-1063
27.5.2.3. Running client applications for recording the user action log
If you want to run your client application to record the interactive action log, you
can use either the UILogRecorder command-line parameter or a special command
in Designer menu: Tools – Run to record user actions log.
You can also specify the number of the TCP port to be used by the testing manager
to control recording to the interactive action log. To do this, use the TPort option
of the UILogRecorder parameter. If no value is entered for this option, 1538
is used. You can also select the location where the system saves the log file.
To do this, use the File option of the UILogRecorder parameter. If this option
is not specified, after the file is recorded the client application opens a text docu-
ment window containing the written log.
So the startup command line for the client application that is to generate an interac-
tive action log looks as shown below:
1cv8c ENTERPRISE /IBName "Test Manager" /UILogRecorder
With this startup option, the right-hand top corner of the main client application
window displays a special command panel that manages log recording.
To start recording user actions, click the only available button on this panel.
This changes the panel appearance (all buttons become available).
2-1064 1C:Enterprise 8.3. Developer Guide
You can use the command panel to stop interactive action recording. This opera-
tion writes an action list to the file (if the File option is specified) or opens a text
document window with a list of actions. You can also interrupt or pause and
restart log recording.
In the sections below objects shown in the above figure are discussed in greater
detail.
Chapter 27. Debugging and Testing of Application Solutions 2-1065
TestedApplication
You can use this object to do the following:
Connect to the tested application.
Disconnect from the tested application.
Get an active window.
Get a list of tested application windows.
Get current information about an error.
Find an object with specified parameters in the subordinate object hier-
archy.
Wait until an object with specified parameters is displayed on the screen.
Manage interactive user action logging in the tested application.
TestedClientApplicationWindow
This object describes the client application window and provides methods of
window management:
Get a collection of subordinate objects for the window.
Search for an object with specified parameters in the subordinate object
hierarchy for the client application window.
Get the command interface of the tested client application.
Work with user messages.
Close the tested form.
Execute a command using a navigation link.
TestedWindowCommandInterface
This object describes the command interface for the tested form of the applied
solution. It has three subordinate TestedCommandInterfaceGroup objects:
Sections panel
Navigation panel
Actions panel
For auxiliary windows, the command interface of the form only has the form
navigation panel.
TestedCommandInterfaceGroup
This object describes the command interface group and allows you to get
a collection of subordinate objects for the group as well as search for an object
with specified parameters in the subordinate object hierarchy.
2-1066 1C:Enterprise 8.3. Developer Guide
TestedFormTable
This object describes a form table and provides methods for managing this
form item:
Get active table item.
Get table cell text.
Navigate through table rows and columns.
Select a row.
Add or remove a row.
Get current table editing mode.
Navigate through hierarchical list levels.
Collapse or expand node for hierarchical lists.
Check the state of the hierarchical list node (whether it is collapsed or
expanded) and the expandability of current row in hierarchical list.
TestedFormButton
This object describes a form button and can be used to simulate a button click.
TestedFormGroup
This object describes a group of form items and provides methods for group
management.
TestedFormDecoration
This object describes form decoration and can be used to simulate clicking
a hyperlink or image.
You can use the configuration comparing and merging mode to compare two
configurations in detail and to merge them. Selective merging based on compar-
ison results is also possible.
You can use the merging mode, for example, when one configuration is developed
by several persons at the same time. Sometimes they need to merge the results of
their work (or merge all results at the end of development).
The configuration comparing and merging mode can also be used to compare two
configurations without merging.
And finally, in situations when you need to load changes to the source configura-
tion, you should review and evaluate them using the configuration comparing and
merging mode.
This mode compares both common properties of configuration objects such as cata-
logs, documents and journals and individual object and tabular section attributes.
Object forms (modules, description texts and templates) are compared separately.
You can view comparison results in detail as well.
Catalog.Goods in another configuration are treated as one and the same catalog;
they are considered a match and are compared.
Objects with different names are compared by internal IDs assigned by the
Designer during their creation. Internal IDs are required to simplify mapping of
configuration objects and make it automatic. For example, this situation occurs
when the object name changes during configuration development. If object names
are different while their internal IDs match, these objects are automatically mapped.
Form mapping is done in a special way. A form can contain several pages. First
forms are analyzed by names; then pages with different names are analyzed by (non-
empty) headers; and then pages with different headers are analyzed by pictures. If
pages match, their controls are compared and merged. If pages do not match, they
are considered different and the final form (after merging) contains all these pages.
Pages that have none of the three properties set (Internal ID, Header and Picture) are
merged by pairs in accordance with the selected sequential order.
This dialog box contains two sections used to select configurations for comparison.
Techniques used in both sections are the same.
You can choose configurations from the master configuration, database configura-
tion, configuration in a file, storage configuration and vendor configuration (if the
current configuration is supported).
If a file or storage is selected, the file or storage version selection combo box
is added to the corresponding section of the dialog box.
If the compared configurations are not descending from each other and it is impos-
sible to match them by internal IDs, you should check the Determine Match By
Object Names box. Click OK to start the comparison process. The Designer will
compare the specified configurations and will display results in the Compare
Configurations window. Techniques used in this window are the same as described
in the Compare and Merge Configurations section. The only difference is that
in the comparison mode you can only view the selected objects and obtain a report
on differences.
2-1074 1C:Enterprise 8.3. Developer Guide
The object mapping status is indicated with the row background color. Possible
statuses are shown below the table box.
The Filter combo box is located below. You can use this box to enable the change
view mode. When the Comparison window is opened, Show configuration differ-
ences filter is enabled. You can select other modes to examine configuration
differences or matches.
Click the Actions button to open the context menu.
Use the Set Mode For All command to open merging mode setup dialog box (see
page 2-1078) and order settings (see page 2-1082) for all objects.
You can select the configuration comparison mode in this dialog box. Mode for
comparing different (non-linked) configurations is used by default.
If configurations are linked, please select the link type. When you close the setting
dialog box (by clicking OK), a special column is added to the Compare and Merge
window. The object changes history is shown in this column with special icons.
The special column is added to the File column if the loaded configuration is a
descendant of the master configuration or to the Base configuration column if the
master configuration is a descendant of the loaded configuration.
Help information for status drill down of the object history Statuses group is also
added to the window.
If the configuration uses multiple languages, selective comparison by languages
is available. To do this, set the Use selective comparison by the following languages
option and specify one or more languages for comparison.
Click Refresh when mapping is cancelled for all these objects. The Designer will
again compare the configurations.
Objects of the master configuration have a beige background (only in the master
configuration), while objects of the loaded configuration will have a green back-
ground (only in the loaded configuration).
To enable mapping select an object and choose Find Objects Relationship from the
context menu. The system displays a list of objects for which mapping is enabled.
The list includes objects of the same type and objects which have not yet been
mapped. Select an object and click OK.
If you choose Use from Loaded Configuration, then the configuration object
is added (if it is new) or replaced (if it is modified). The entire object struc-
ture, modules, forms and descriptions are moved. The loaded configuration has
maximum priority.
When you pick the Merge method, merging behavior depends on the specified priority.
If you need to take only new items from the loaded configuration and to preserve
the old configuration as much as possible, choose the Merge Prioritizing Master
Configuration option. Only new objects are added in this mode.
Texts are merged as follows:
Text Priority Result
Deleted (exists in the master Master configura- Remains in the text
configuration, but doesn't exist in the tion priority
loaded configuration)
New (exists in the loaded configura- Added
tion, but doesn't exist in the master
configuration)
Modified Added as comments from the loaded config-
uration. Contents of the master configuration
remain unchanged
Deleted Loaded configura- Turns into comments
New tion priority Added
Modified Changes in the master configuration are
turned into comments; changes in the
loaded configuration are added
Procedure SpecifyStatus(Item)
// Insert handler contents
Message("Message from the master configuration");
EndProcedure
The table below shows the dependence of merging results on the priority and value
availability for objects that have property values specified in the properties palette
(e.g., Synonym, Comment).
Value in Master Value in Loaded Result (value
Configuration Priority
Configuration Configuration is taken from…)
Specified Specified Master configuration priority Master
Specified Not set Master
Not set Specified Loaded
Specified Specified Loaded configuration priority Loaded
Specified Not set Master
Not set Specified Loaded
can be displayed in the text format in a report on object comparison. Mapping
is performed according to the following rules when forms are compared:
Module texts are compared by procedure names.
Form elements are compared by element type and name.
Form options are compared by name.
Commands are compared by name.
Attributes are compared by name.
For the command interface, comparison is performed by command type (auto-
matic or custom) and command name.
Elements with the same names will be replaced in the master form (the properties,
size and dimensions will be specified) if the loaded configuration has priority, but
they will be left unchanged if the master form has priority. Some form element
properties can be merged (e.g., a selection list, titles in different languages, etc.).
Form merging mode can be configured both for the whole form – for managed and
ordinary forms, and for the form and the module form – for managed forms only, as
shown in the fig. 430.
From the Form joining setup window, you can also open the module comparison
window (see page 2-1083) by clicking the button with the magnifying glass in the
right side of the Module: field.
For some objects (object attributes) it may be impossible to pick the merging
mode. Thus, for attributes with primitive type (e.g., Number), only the Use from file
merging mode is available.
For some objects it may be impossible to select priority. For example, for Subsys-
tems property you can select the Use from file and Merge merging modes. If you
2-1082 1C:Enterprise 8.3. Developer Guide
choose the Merge mode, then the specified subsystems of the two configurations
are simply merged.
For rules of merging predefined data see page 2-1074.
Spreadsheet documents are compared by cells. If cells differ (any properties except
Details Parameter), the difference is shown in color. The color legend is shown
at the bottom of the comparison window.
The top of the window contains a table box that corresponds to the table box from
the Merge Configurations window. The only difference is that the column content
is taken from the names of module parts: variable declaration area, procedures and
functions section and main program area (henceforth, the objects). Any of these
sections can be missing.
The contents of the table box are determined by the currently set filter (Filter
attribute).
Select differing objects that need to be merged in the first column. You can
customize the merge settings for the selected objects.
Comparison is done separately for each section. Only objects that are mapped are
compared. Auto-mapping by name is performed as an initial step.
You can clear any mapping of procedures and functions. To cancel mapping select
the line with the object from the list and choose the Clear Object Mapping command
from the context menu.
If object names in the compared modules have changed, but objects still have the
same contents and need to be compared, you have to map the objects manually.
To map the objects choose any object for which the setting is to be made and
choose Set Object Mapping from the context menu.
The Test() procedure of the main configuration on the figure above corresponds
to the ShowHeader() procedure of the loaded configuration. The Merge Modules
window shows differences between these objects after manual mapping (see
below).
Differences between the objects are shown when the Display Result option
is unchecked. If this option is checked, the merging result is shown with consid-
eration for the merging mode.
Chapter 28. Compare and Merge Configurations 2-1085
Use the Continue button to merge only the checked objects without consid-
eration for unresolved references. In this case the specialist who performs merging
is responsible for merging results.
DISTRIBUTED
CONFIGURATION
DEVELOPMENT
In the Repository location (files directory or remote repository address) field, enter
the directory where the configuration repository is to be created. This directory
should not be registered as a storage place for another configuration repository.
Click Next >.
If an object has been locked by another user (see fig. 440), it can be modified only
by the user who has locked it. The metadata object tooltip that appears above the
current object status icon in the configuration repository contains the name of the
user who has locked the object, lock date, name of the computer used to connect the
user to the configuration repository and location of the infobase.
2-1092 1C:Enterprise 8.3. Developer Guide
Newly created objects that have not yet been checked in the configuration reposi-
tory and objects that have been deleted from the repository but still exist in the
local configuration are represented by an icon in the form of a red mark.
Upon the first login the Designer stores the connection parameters (the configura-
tion repository directory and username) for the given infobase. The next time the
user opens the configuration, the Designer requests to connect to the configuration
repository before displaying the Configuration window.
If an incorrect username or password is entered when logging into the configu-
ration repository or if a user with this name is already connected to the given
repository at that moment, then the following message appears: Configuration
repository authentication error. Check whether the user name and password are
entered correctly.
If there is an attempt to bind a configuration not previously connected to the
configuration repository by entering a username for which there is a registered
connection (established link) to the repository, but for another infobase (which
is not open at the moment), then the Designer displays the following message:
Configuration bound to this configuration repository already exists for this user.
Continue? After an affirmative response the configuration is loaded from the
configuration repository (the current configuration is completely replaced and
saved to disk) and a new infobase and configuration repository link is established.
In this case the former link is dropped (the infobase which was connected earlier
to the configuration repository cannot be joined to this user without reconnecting).
If there is a login attempt to the configuration repository and the configuration
is currently open, the Designer displays an error message showing the username
for the attempt.
Administrative tasks – user has privileges to create, delete and disconnect users,
cancel locks, change the repository compatibility mode and run the optimization
procedure.
Change version structure – the user has the right to roll back and delete old versions
(for details see page 2-1102).
Lock objects – the user with this right can lock and make changes to the configu-
ration of the configuration repository. If this right is not set, the configuration
repository objects for this user are read-only.
The Users tab contains controls which manage the list of configuration developers
(hereinafter referred to as "users" in this chapter). All users can change their own
login credentials (username and password), but they cannot change their access
rights. Names of users that are currently connected to the configuration repository
are shown in bold. On fig. 443 it is Jones.
2-1094 1C:Enterprise 8.3. Developer Guide
IMPORTANT!
Only users with administrative permissions can add, delete and change user rights.
The Connections tab lists users logged into the configuration repository.
You can disconnect any user who is not currently working with the configuration
repository from the repository by pressing the Disconnect button.
IMPORTANT!
The Disconnect button is accessible only to users with administrative permissions.
You can release object locks for a particular user by using the Release locks tab.
The user would be unable to store any changes he or she has already made to the
locked objects in the configuration repository.
IMPORTANT!
This button is accessible only to users with administrative permissions.
Chapter 29. Distributed Configuration Development 2-1095
The Other tab contains parameters that manage the repository operation.
The Repository data optimization group can be used to perform optimization for
a repository that is not compatible with version 8.3.2 (the compatibility mode
is set to Do not use). Optimization results in higher repository performance.
You should only perform optimization if the system prompts you to do so.
A user with administrative privileges can enable a prompt for optimization after
performing each repository operation (adding objects, rolling back or merging
versions). To do this, select the Prompt for optimization after performing repository
operations checkbox on the Other tab of the repository administration dialog. If this
option is selected, after a repository operation is complete, the following dialog
may be displayed to the user:
If the user (repository administrator) chooses to skip optimization when the prompt
is displayed, optimization can be run later. To do this, open the repository admin-
istration dialog, go to the Other tab and click the Optimize button. You should
click the button if the optimization prompt is displayed to the right of the button.
Repository optimization can take a long time (see fig. 448).
We recommend that you do not work with the repository during optimization.
You can also run optimization using the following Designer startup command-line
option: /ConfigurationRepositoryOptimizeData.
2-1096 1C:Enterprise 8.3. Developer Guide
In the second column, the status of locked objects is shown by icons. Objects
locked by the current user are represented by an icon with a red checkmark. In the
User column, the user who has locked the object is shown. In the Date column,
the lock date (if the object is currently locked) or the date of the last update for
this object is shown. In the Computer column, the name of the user's computer
is shown and in the Infobase column, the name of the local infobase directory on
the user's computer is shown.
IMPORTANT!
Newly created objects that are not yet stored in the configuration repository do
not appear in the configuration repository window.
If this object is linked to other objects, then these objects are also included in the
list. In this case the selected object is displayed in bold. You can only lock selected
objects when these objects are also retrieved from the configuration repository.
The list also includes objects that are not directly linked to the chosen object, but
have an indirect link.
To retrieve these objects select the check box in the first column of the list. If you
need to not only retrieve, but also lock these objects, select the check box in the
Lock column. If not all objects required for the lock are marked for retrieval, the
Designer displays the following message: This operation requires the following
objects to be retrieved. The message is followed by a list of required objects.
Locking in this case does not occur.
If the objects contain subordinates that need to be locked, select the Retrieve Recur-
sively check box.
If you need to retrieve data of objects that are already locked, select the Allow to
Retrieve Locked check box.
IMPORTANT!
If the Allow to Retrieve Locked check box is selected, changes made in locked
objects are lost when re-retrieving occurs.
Locked objects are marked by a special icon.
Chapter 29. Distributed Configuration Development 2-1099
Before you can add new objects to the configuration, you must lock the parent object.
For example, to create a new catalog lock the root object of the configuration and to
create a new form or attribute for the catalog lock the catalog object itself.
After the parent object has been locked, subordinate objects can be created.
Then every new object, along with the locked parent object, should be placed
in the repository.
Select the check boxes for objects to be stored in the configuration repository.
Changes made to the objects can be entered into the multiline Comment field.
This text can be viewed in the configuration repository history.
If the objects contain subordinate objects that need to be stored in the configura-
tion repository, select the Retrieve Recursively check box.
Select the Allow to Retrieve Locked check box if the specified objects should remain
locked.
In the case when objects linked to other configuration objects are stored in the
configuration repository, the entire list of these objects appears in the dialog box.
To store new objects in the configuration repository choose an object in the
Configuration window and select Store in Repository from the context menu.
The window for storing objects in the configuration repository appears.
Other objects linked to the given object can also be included in the list. In this case
the selected object appears in bold in the object list. An object cannot be stored
in the configuration repository without updating these objects as well.
2-1100 1C:Enterprise 8.3. Developer Guide
In the list of objects, select the check box for those objects that must be retrieved
from the configuration repository.
If the objects contain subordinate objects that need to be retrieved, select the
Retrieve Recursively check box.
If the selected object is already locked, then selecting the Allow to Retrieve Locked
check box causes changes made to the object to be lost. In this case the object data
are restored using data from the configuration repository.
In the second column of the list, the icon shows the difference between the configu-
ration and the configuration repository objects. If the icon is not shown, then the
objects are identical.
If objects contain subordinate objects that need to be released, select the Retrieve
Recursively check box.
After the locks have been released, the objects are retrieved from the configuration
repository.
comparison from the configuration tree, the object is compared with the latest
object version stored in the configuration repository. If selective comparison
is unavailable, the platform informs the user of this through a diagnostic message.
You can run a selective comparison for the following configuration objects:
module, template, image, WS reference, schedule, register aggregates, exchange
plan contents, style, start page working area, flowchart, form, help content, prede-
fined items, command interface fragment and role rights.
A chronological list of configuration versions appears in the table box in the left
part of the window.
Below the list of versions is a field to enter comments for the version.
A list of objects that have been changed, added or deleted in the chosen version
appears in the table box located in the right section of the window.
Chapter 29. Distributed Configuration Development 2-1103
Multiple selections are allowed in the version list. In this case comments on all
chosen versions appear in the Comment field and a list of all objects in the given
versions appears in the list of objects.
You can open each object from the list in the Repository History window to view
the history of changes and compare it with the object of the current configuration.
This is done using the context menu of the object list.
Select the type of information grouping in the report in the Report by group.
In each group, information is arranged in alphabetical order.
To group information by version number select Repository versions. To group
information by objects, select Objects. To group information by comments in the
configuration repository history, select Repository versions comments.
Select the type of report layout (text or spreadsheet document) in the Create as group.
Additional report parameters can be specified in the Options group.
To exclude comment lines starting with "//", select the appropriate check box.
2-1104 1C:Enterprise 8.3. Developer Guide
To specify objects to report on as well as a date range, click the Filter button.
In the window that opens, set the filter criteria.
To start the report generation process click OK.
29.2.11.6. Filter
A filter dialog box for the Repository History list is different from the standard
filter dialog box.
The left section of the Repository History window contains a list of objects which
have been added, modified or deleted for every selected version. This list is always
complete for the given version (it does not depend on filter criteria). If specific
configuration objects are selected in the filter criteria (not the entire configuration),
then the objects in the list that meet the selection conditions are highlighted by
a different background color.
Each object change can be viewed, compared with the current object or compared
between the versions (you need to select two versions in the list to do this).
Chapter 29. Distributed Configuration Development 2-1107
For every object version, you can view comments and labels in the same way as
for configuration versions (see above) as well as retrieve the configuration of the
given version from the configuration repository.
You can filter the object version list. The filter is applied in the same manner as
the configuration repository history filter described earlier in this chapter. The only
difference is the selection and marking of the current object in the list of objects.
If you need to go to the configuration repository history window, choose Configura-
tion Repository History from the Go To menu within the object history window. If
you need to open the configuration repository history window and set a filter by
the current object, select Configuration Repository History by Object.
The same configuration repository server provides clients with the possibility of
working with different configuration repositories. The only limitation is that all
configuration repositories have to be located in the same root directory.
The name specified in the Alias field will be used in generating URL access to the
repository. Then specify the name of the folder with the files of the directory that
you are creating.
The next step is to specify which actions should be permitted with regard to
working with the directory. You should allow Read and Execute (such as execu-
tion of ISAPI applications or CGI). Other rights should be disabled.
Chapter 29. Distributed Configuration Development 2-1113
The next step is to click the Finish button. This completes the process of virtual
directory creation. Then you should set up the directory created and record the web
server extension for this directory. To do this, open the properties of the virtual
directory created and click Setting in the dialog that opens.
The IIS web server extension can be the wsisapi.dll dynamic library located in the
bin directory of the specific 1C:Enterprise version.
2-1114 1C:Enterprise 8.3. Developer Guide
TIP
To record the web server extension, use either a short path ("format 8.3") or
install 1C:Enterprise in the directory that does not contain spaces or directory
names exceeding 8 characters.
You can specify either a specific extension (.1ccr), or a mask of all files (*) as the
extension (the Extension: field in the dialog in fig. 470).
The last step is to restart the web server.
The name specified in the Alias field will be used in generating URL access to the
repository.
Then add the handler for .1ccr files. To do this, select <Name of computer that runs
the web server> – Sites – Default Web Site – storage – Handler Mappings – Add
Script Map.
The IIS web server extension can be the wsisapi.dll dynamic library located in the
bin directory of the specific 1C:Enterprise version being used.
You can indicate either a specific extension (.1ccr) or a mask of all files (*) as the
extension (the Request path: field in the dialog in fig. 472).
The last step is to restart the web server.
Chapter 29. Distributed Configuration Development 2-1115
Create a virtual directory on the web server to provide access to the configura-
tion repository and record the file handler for the virtual application directory.
The identifier of the handler being recorded is 1c-application.
Sample virtual directory for Windows:
Alias "/repos" "C:\www\repos\"
<Directory "C:\www\repos\">
AllowOverride None
Options None
Order allow,deny
Allow from all
SetHandler 1c-application
</Directory>
Add the *.1ccr file to the folder with the virtual directory files and specify the
address of the configuration repository server in this file (tcp scheme).
.1ccr sample file:
<?xml version="1.0" encoding="UTF-8"?>
<repository connectString="tcp://192.168.0.12"/>
29.3.4.1. Windows OS
The configuration repository server is launched via the command line:
crserver.exe -instsrvc | -rmsrvc -usr <user> -pwd <password>
- start | -stop
-port <port> -d <directory>
If server storage is installed as a service, it is called 1C:Enterprise 8 Configura-
tion Repository Server.
IMPORTANT!
The option name and its value should be separated by a space.
-start
Start server repository service.
-stop
Stop server repository service.
-instsrvc
Register server repository as a service.
-rmsrvc
It removes registration of the server as a service.
-usr
Name of the user registering the service. This user should be assigned the Log
on as a service right. Additionally the user must have read access rights to the
executable files directory in the relevant 1C:Enterprise version and full access
rights to the configuration repository root directory (%APPDATA%\1C\1cv8\ by
default or the directory indicated by the -d switch).
-pwd
Password of the user registering the service.
-port
Operation port of the configuration repository server. 1542 is used by default.
-d
Root directory for configuration repositories. %APPDATA%\1C\1cv8\ is used
by default.
2-1118 1C:Enterprise 8.3. Developer Guide
29.3.4.2. Linux OS
The configuration repository server is launched via the command line:
./crserver -daemon -port <port> -d<directory>
IMPORTANT!
Parameter name and value should be separated by a space.
-daemon
The server is launched as a daemon.
-port
Operation port of the configuration repository server. 1542 is used by default.
-d
Root directory for configuration repositories. /home/usr1cv8/.1cv8 or ~/.1cv8
is used by default.
Example:
tcp://RepServ/MyConfRep
Or:
http://www.MyCompany.ru/VirtualFolder/storage.1ccr/MyConfRep
CONFIGURATION
DISTRIBUTION AND SUPPORT
Only the first level objects are available in the hierarchical list of configuration
objects.
You have to specify a modification rule for each object. To do it select an object
and click the Edit button. To change the rules for a group of objects, select a group
and click the Change Subordinate button.
You may make multiple selections in the object tree. In this case a new setting
is applied to the selected objects.
The following rules can be specified:
Changes allowed – all user configuration changes are allowed.
Changes not recommended – user configuration changes are not recommended.
Changes not allowed – all changes are forbidden. This right makes it impos-
sible to modify supported objects. It is impossible to disable support for an
object with this rule. To modify such an object the user would need to disable
support for the entire configuration.
Inclusion in configuration not recommended – when support is enabled by
merging with a provider configuration or updating with a new provider config-
uration, the object with this rule is by default not prompted to be included
in the user configuration.
By default the Designer uses the Changes allowed rule.
Check the Include source texts of object modules to distribution option if the distri-
bution contains only the compiled module text. In this case the functionality will
not change, but module text will not be available for viewing.
Uncheck the Include source texts of object modules to distribution option if the
distribution contains only the compiled module text. In this case the functionality
will not change, but module text will not be available for viewing. Exclusion of
source texts is not supported for the following modules:
managed application module
form modules
command modules
modules containing preprocessor instructions
common client modules in the managed mode (thin client, web client and thick
client's managed mode).
NOTE
If the Include source texts of object modules to distribution checkbox is unchecked for
the root configuration element, the normal application, external connection and
session modules will be distributed without source texts.
Check the Distribution file can be used for updates option for a distribution file if
it is intended for a regular configuration update. Uncheck this option if you plan
to use this distribution file as an intermediary in cases when a sequence of updates
is needed.
For example, if you change an attribute directly, this may cause data loss for some
users. Therefore, it is often necessary to use an intermediate version where a new
attribute is added without deleting the old attribute. Usually only the update file
is prepared. Data conversion is performed by a special handler. Then another
configuration update is applied where the name of a new attribute is changed to
2-1124 1C:Enterprise 8.3. Developer Guide
the name of the old attribute. The second version is used only as an intermediate
procedure and it cannot be used as an independent update.
Click the Close button after specifying the relevant rights.
Click Distribution files directory to create a directory for creating new distribution
directories. The version directory name is the same as the version number.
Check Create distribution file to create a distribution file. A default distribution file
name will be suggested.
Chapter 30. Configuration Distribution and Support 2-1125
Check Create configuration update file to create an update file. A default update file
name will be suggested.
If you check the Create configuration update file option, you have to include
previous updates in this file. Use the Add from Previous Versions command and
choose previous versions of distribution files to include previous updates to the
new update.
Click Run to create the specified files.
A distribution kit generated in Windows OS is not fully functional in Linux OS,
since the Windows file system does not support setting the Run (X) attribute for
the setup file intended for Linux. This means that, to be able to launch the setup
application, you need to set this attribute for the setup file either after you copy
the installation kit to a computer running Linux or when you create a setup disk
image. You should set the Run attribute in Linux. The installation program for
Linux (setup) can be launched in both a 32-bit version and 64-bit version.
Text files of the distribution kit are to be encoded in UTF-8.
These files are passed to developers responsible for the end user configuration
support.
Specify the distribution kit name and vendor name. Click Next >.
Specify template parameters at the next step.
By default (the Determine Options Based on Current Configuration box is checked)
parameters are selected from the corresponding configuration properties. If this
option is not checked, you may edit these parameters.
The Path parameter specifies a directory where a manifest file will be created.
Template parameters are recorded in the manifest file which is a part of the distri-
bution kit. For information about manifest file structure see "1C:Enterprise 8.3.
Administrator Guide".
Specify template parameters at the next step (see fig. 479).
Mark the template files that should be included in the distribution kit description.
Specify a directory for additional files in the kit. All files in this directory and its
subdirectories will be included in the distribution kit.
Chapter 30. Configuration Distribution and Support 2-1127
The distribution kit description editing window is used for distribution creation
purposes.
Description represents a tree that consists of four main branches:
configuration templates
distribution options
home directories
languages
You may add, modify or delete any data at any branch. Use the Actions menu to
manage the description tree. Use the properties palette to edit properties.
2-1128 1C:Enterprise 8.3. Developer Guide
Configuration Templates
Configuration templates are the main items of the distribution kit. Configuration
templates consist of files and file groups.
Files may include arbitrary files (or file sets that are determined based on a mask)
and configuration files or data dumping files obtained from the current infobase.
Each template is placed in the template directory. All files and file groups are also
placed in the template directory based on the manifest file address (file groups are
represented as subdirectories).
The manifest file contains only configuration files and data dumping files.
The other files are placed in the configuration template directory.
Templates
To set up template properties choose a template and specify its properties.
Current configuration – when you check this option, the data (vendor, name and
version) are picked from the current infobase. If this option is not checked, you
may edit these properties.
Vendor – configuration vendor (the same as the Vendor configuration property).
Name – configuration name (the same as the Name configuration property).
Version – configuration version (the same as the Version configuration prop-
erty).
Location of manifest – relative path to the template manifest file in the template
directory.
Files and File Groups
To add a file pick a template and run the Actions – Add command. The file selec-
tion dialog will open.
Location of the template item to be added is specified in the dialog box.
The file can be located in the current configuration, in the current infobase, in a
separate file or may be a set of files in a specified directory picked based on
a mask (subdirectory files may be included).
Chapter 30. Configuration Distribution and Support 2-1129
Distribution Options
Distribution options contain different combinations of distribution files. Such
a combination may be used for different distribution contents (e.g., full distribution
vs. update distribution).
Description – name of distribution option.
Distribution files – set of distribution files. By default a full version containing
all files is created. If you specify several options, you may specify a set of files
for an option using the Edit link in the properties palette. Check the files that
will be added to the selected distribution option.
Distribution description file – description that is shown to user when the product
is installed.
Home Directory and Directory – these
parameters specify location of distribu-
tion kit or distribution files. If you
specify these directories, they are auto-
matically added in the prompting dialog
box for kit creation.
Home Directories
Home directories are used to specify the distribution files that are moved between
different computers.
You may specify an environment variable or directory name as the home directory.
Then you may specify the distribution file name as a combination of the home
directory and relative path from the home directory.
Description – name of the home directory.
Home – can have one of two values:
○○ Environment variable;
○○ Directory.
Environment variable/Directory – contains name of environment variable or an
absolute path to a directory depending on the value of the Home property.
Languages
Languages are used to show localized names of template items.
To display the names correctly it is necessary to create languages in accord-
ance with the directory names in the 1C:Enterprise platform containing the
corresponding localized interfaces. One of the languages is considered a default
language (a localized line in the default language shall be used if no line corre-
sponding to the current platform language is available).
Name – language name.
Resource directory – language resource directory for this language.
NOTE
To create a distribution kit for a configuration distributed via licensing per
user seat, the -DigiSign option is implemented for CreateDistributionFiles and
CreateDistributive command-line keys, allowing you to specify a file with licens-
ing parameters. The creation and distribution of configurations supporting per-
user-seat licensing can be enabled for a partner based on a separate agreement
with 1C Company.
Vendor support rules cannot be changed. Only user rules can be changed (if the
configuration is not under full support). You may make multiple selections in the
settings window to configure the same support rules for selected objects. Use the
context menu in the support rule columns to change the support rules.
A distribution file may contain information in several languages. Use the support
language selection feature to specify the languages that are used in the current
configuration. Click the Support Language button to open the language selection
window.
When you specify support rules and click OK, the configuration status is changed
and it will be supported with the ability to make changes. In the result, all config-
uration objects will be locked from random changes regardless of the distribution
Chapter 30. Configuration Distribution and Support 2-1135
rules set by the provider. Now, to change the object you need to explicitly enable an
ability to change the object or its subordinate objects (see page 2-1135).
If you do not need to change the support mode (the actions were performed by
mistake), close the configuration without saving.
After canceling full support, you can turn it on again for the entire configuration
only as follows:
disable support for the configuration (select the root configuration object in the
settings window and use the Actions – Cancel Support command);
run the Configuration – Load Configuration from File command;
select a distribution file.
For more information about comparison and merging see page 2-1057.
Unlike the "standard" configuration comparison and merging mode, the comparison
window contains a line for vendor and user rules and the Edit button for changing
user rules.
When you compare the current configuration with the distribution file, the current
configuration is always a descendant of the vendor configuration. Therefore, the
configuration setup mode selection button is not available.
At the first screen, the user may select a separate update file for the configuration
update or search possible locations of update files.
If you select a separate update file, you have to choose it on the next step.
When you click Ready, a dialog box with main parameters of the current configu-
ration and vendor configuration (see below) will open.
If you select the update search option, click Next > to specify possible update loca-
tions in the update wizard.
Specified remote directories are searched for template list files. Other directo-
ries (subdirectories) are not searched.
If the Update directory address configuration property contains an address that
can be used to obtain the configuration update, clicking Next > invokes the user
authentication procedure.
You have to enter the username and password to access the server with update set.
You also have to enter the username and password for the proxy server if required.
At the third step, you will see updates for which templates have been found. Files
that most probably can be used for configuration updates are marked in bold.
If you pick an update in a remote directory, this update is copied to the current
template directory (if it is local).
Click Finish to finish searching for update files.
A dialog box with main parameters of the current configuration and vendor
configuration will open.
Chapter 30. Configuration Distribution and Support 2-1139
Click OK to continue.
The Designer compares the configurations and opens the Update Configuration
window.
For more information about comparison and merging see page 2-1071.
In addition to standard fields for comparison and merging, this table box contains
two more columns that show the object history status. The status icon drill down
is provided in the lower part of the window. The icons can be used to easily find
out what changes have been made and to determine the affected configuration.
2-1140 1C:Enterprise 8.3. Developer Guide
For example, the figure demonstrates that the Address and Phone attributes have
been added to the Competitors catalog in the main configuration, while attributes
of the Nomenclature and Units of Measure catalogs have been changed in the
vendor configuration. The Address and Phone attributes have also been added to
the Competitors catalog, but their order differs from that in the main configuration.
Pick an object in the table box to view vendor rules. The rule is displayed in an
attribute below the table box.
To analyze configuration changes it is convenient to use a special filter that can
be called using the Filter button. The settings window will open:
You may use a filter to examine the configuration changes by selecting objects for
comparison and specifying difference display modes.
The main (current) configuration, the new vendor configuration and the old vendor
configuration may be used as comparison objects. Therefore, the filter setting
window consists of three sections with similar attributes. Each section is used to
configure the comparison mode for any pair of configurations.
You may use a filter to configure the differences display mode for all configura-
tions.
You may use a filter template for more convenience. A template contains the most
commonly used settings.
The user makes the decision regarding merging based on the information on
changes and support rules.
Chapter 30. Configuration Distribution and Support 2-1141
To create template directory description file use the Create Template List File
command in the command bar of the Templates table. You have to run this
command to save changes in the template directory description.
After this move the template directory (and the directory description file) to the
required external resource.
The following approach is generally applied to work with templates located at
HTTP(S) or FTP resources:
1. A directory that will store templates published at external resources is created
on the local drive.
2. All templates to be placed in external resources are added to this directory.
3. The Designer (Configuration template directories window, see above) adds the
template directory created on step 1 to the Directories: list.
4. Template directory description file is created in the Configuration template
directories window (Create Template List File button). To do this, place the
cursor over the template directory added on step 3.
5. Then move the template directory (and the template directory description file)
from the local directory to the HTTP(S) or FTP resource.
Chapter 31
SERVICE FEATURES
1C:Enterprise has abundant service features and modes. They are described in this
chapter.
If the Dockable property is not turned on, you cannot select the Docked or Autohide
modes.
For the Docked and Autohide modes, the Dockable property is always turned on
and cannot be disabled.
The Docked mode requires special discussion. In this mode a window may be:
attached (docked) to one of the borders of the Designer window;
attached (docked) to any border of any other window with the Docked property
turned on;
displayed above any other docked window (stacked windows).
If the Docked mode is turned on for a window, this window is attached to one of
the borders of the work area or to another window in Docked mode.
To modify the size of a docked window, move the mouse cursor to a free border
(turned to the work area) and drag the border with the mouse.
If the window is in Floating mode and you drag its border close to a work area
border or another Docked window, the window borders may change abruptly. If
you release the mouse button at this time, the window attaches to a new border and
its status is changed to Docked.
You can change the status of docked windows by moving them with the mouse.
To move a window left click and hold the window header and drag the window to
another location. The window state is changed to Floating.
There are several ways to attach multiple docked windows to the Designer window
or another window border. Windows can be arranged in layers when each window
occupies the entire width of the work area of the Designer window or a different
window. It is possible to place windows in sequence so that each window
is located in one layer along the border of another window. If there are more
than two windows docked, you can arrange some of them in layers and the others
in sequence.
To arrange one docked window above another (create stacked windows), please do
the following:
grab the window header with the mouse;
move the window so that its header fits over the header of another docked
window. The dragged window should have a tab contour at the bottom;
release the mouse button.
Now tabs will show up at the bottom of the docked window. The tab text will be
the same as the window header text. The tabs contain stacked windows.
Click a tab to open the corresponding window.
The Close command can only close an active tab in this case.
To separate stacked windows grab the appropriate tab with the mouse and drag
it away (you can control the contour of the window you move).
Chapter 31. Service Features 2-1145
If the mouse pointer remains in the tab area, you can change the tab order in this
way.
If some windows are docked to each other, you can attach more windows to them
by dragging new windows to the tab area instead of the header. You can specify the
tab order in this way.
You can also arrange windows in the Autohide mode. If the Autohide mode
is selected, an additional line appears on one side of the work area. This line
contains window tabs, including a tab for the current window attached to this
side of the work area. Location of this line is determined by the window location
in Docked mode. In this mode a window remains on the screen while it is active.
Once a window is activated, the previous window becomes hidden. To open
a window move the mouse cursor over the tab for this window (do not click).
When the mouse is moved away from the window, the window is automatically
hidden.
For docked windows you can also specify a mode other than stacked. For example,
the Autohide mode is very convenient. In this case an additional line will contain
only tab icons. Move the pointer over the tab icon to restore a hidden window and
display its name in the additional line.
has free space). If there is no place to display it, the subordinate window attempts
to expose the left part of the owner window provided that 50% of the owner width
can be unclosed.
Window Dock Location defines position of a docked form window relative to the
work area.
Change Size permits or forbids changing the size. The DontChange option does
not affect the ability to change the size of a window in the Docked and Autohide
modes.
31.2.1. General
This tab contains a single parameter that defines operation mode and interface for
Designer – Edit configuration for startup modes.
The parameter can have one of two values:
Managed application. In this case the system hides interface items used to edit
properties and objects in the ordinary run mode.
Managed and ordinary application. In this case no interface items are hidden
and the user can edit the configuration in both ordinary and managed mode at
one time.
This parameter is stored and can be set up for each particular infobase.
By default the parameter is set to the managed mode; however, if the user loads
a configuration with Default run mode property set to Ordinary application
Chapter 31. Service Features 2-1149
(or if this property can be changed interactively), the parameter is assigned the
Managed and Ordinary Run Mode value.
The following Designer interface items are hidden when the parameter is set to the
managed mode:
Styles metadata tree branch
Interfaces metadata tree branch
Default Interface configuration property
selection of default interface in the user's editing dialog box
Forms tab in the Designer parameters
Default run mode dropdown list on Modules – Check tab
Use managed forms in ordinary applications configuration property
Use ordinary forms in managed applications configuration property
Interfaces tab in metadata editing windows
Open ordinary application module configuration context menu item
flag of managed form creation in the form wizard
Report Generator commands
Client (ordinary application) common module property
Additional tab on the Forms tab of the configuration object editing window
Interactive Activation Data processor and Before Execute Interactively event
handlers for a business process route point of the Activity type
31.2.2. Texts
Texts tab controls are used to configure the text document editor.
Drag and drop text. You can use the drag & drop mode to copy and move text
blocks in the text editor.
Allow cursor beyond end of lines. If the option is enabled, the cursor can be posi-
tioned after the line end. Otherwise the cursor position is limited to the line break
symbol.
Show spaces and tabs. If enabled, space and tab symbols are displayed in the
text. This option is used to verify text formatting. With the Show spaces and tabs
enabled, the Space and Tab properties allow you to specify the display characters
representing spaces and tabs:
Space – specifies the symbol used to display spaces;
Tab – specifies the symbol used to display tabs.
Replace tabs with spaces when typing. If this option is turned on, tabulation
symbols are replaced with the number of spaces specified in Tab width.
Tab width. It defines the number of characters that corresponds to a tab symbol
during text input.
Autoindent. It sets or removes automatic indentation when the line break symbol
(the Enter key) is entered.
Font. It specifies the font to be used for text input. It is recommended using
a fixed-width font for module code (e.g., Courier New).
Autoreplace. If this option is turned on, the entered text that corresponds to the
text in the Automatically replace string attribute of the template is automatically
replaced with template text. If this option is set to Enable with Prompt, the template
text is displayed after a short pause while the text to be replaced is being entered.
If this option is set to Prompt Only, template text is shown after a short pause, but
the text is not replaced.
To replace input text with template text, press Spacebar or Enter after typing the
string.
31.2.3. Modules
The Modules tab controls are used to configure color highlighting of module code
syntax, auto-indentation and tabulation step sizes for modules and to set up groups.
Settings are combined in two sections, each located on a separate tab.
Disable color highlighting. If set, module text is displayed as ordinary text and the
color highlighting setting is unavailable.
Autoreplacement. If this option is turned on, the entered text that corresponds to
the text in the Automatically replace string attribute of the template is automati-
cally replaced with template text. If this option is set to Enable and show tooltips,
the template text is displayed after a short pause while the text to be replaced
is being entered. If this option is set to Show tooltips only, tooltip text is shown
after a short pause when you type the replaceable text.
To replace input text with template text, press Spacebar or Enter after typing the
string. If the Autoreplacement option is set to Disable or Show tooltips only , these
actions are not performed.
Use Autoreplacement in comments. If this option is set, template text is displayed
when the user enters matching text into comments.
Replace tabs with spaces when typing. If this option is turned on, tabulation
symbols are replaced with the number of spaces specified in Tab width.
Tab width. It specifies the number of Space characters equivalent to one tab character.
Autoindent. It sets or removes automatic indentation when the line break symbol
(the Enter key) is entered. If the Use syntax rules value is selected, text entry
proceeds taking the current syntactic construct into account.
Font. It specifies the font to be used for text input. It is recommended using
a fixed-width font for module code (e.g., Courier New).
2-1152 1C:Enterprise 8.3. Developer Guide
Use the module check settings to select a suitable environment for compilation.
Execution environment includes common modules with an appropriate flag and
special modules used in a particular execution mode (managed application module,
session module, etc.). If execution environment compilation is successful, the
module that has initiated syntax check is verified. The number of check passes
(including execution environment compilation) is defined by the number of check
boxes selected in the dialog box. Modules that do not exist in the selected check
mode are not verified; e.g., application modules are not checked if the Thin client
check mode has been selected.
Availability of the Default run mode dropdown list in the form depends on the Edit
configuration for startup modes parameter (see page 2-1148). If the parameter value
is Managed application, the dropdown list is missing from the form; the Thick
client (ordinary application) parameter is also hidden in this case. When the dialog
box is opened, the parameter value always matches the Default run mode configu-
ration property value.
If the Default run mode dropdown list is available in the form, the user can select
check modes for each run mode. If the Ordinary application mode is selected, only
the Thick client (ordinary application) check box is set by default; if Managed appli-
cation is selected, Thin client and Server are checked. The user can specify a new
set of check boxes for each run mode and click Apply or OK. When the Edit configu-
Chapter 31. Service Features 2-1153
ration for startup modes parameter changes value (see page 2-1148), the Designer
restores the required set of check modes.
The selected run mode determines preprocessor instructions:
Check Mode Preprocessor Instruction
Thick client (ordinary application) Client, AtClient, ThickClientOrdinaryApplication
Thin client ThinClient, Client, AtClient
Web client WebClient, Client, AtClient
Server Server, AtServer
External connection ExternalConnection
If the Group column is checked, this syntactic construct is automatically grouped.
Please note that only syntactic constructs at the second level of nesting can be
grouped.
If the Collapse column is checked, this syntactic construct is automatically
collapsed when a module is opened.
2-1154 1C:Enterprise 8.3. Developer Guide
If the Automatic hint when "." is typed option is checked, context tip is displayed
automatically when the user types ..
If the Automatic hint when "=" is typed option is checked, context tip is displayed
automatically for system enumeration value selection when the user types "=".
The Automatic hint when a quotation mark is typed checkbox enables context tips
for the options of some methods, if an option is set by a string.
The Automatic hint when "(" or "," is typed checkbox enables context help for the
parameters of system procedures and functions, including procedures and functions
of the applied solution with comments using a special format (see page 2-951).
If the Include templates in the list of hints option is checked, templates with auto-
replace strings defined are also listed.
If the include keywords in the list of hints option is checked, all keywords (e.g.,
If, Procedure, Do, Return, etc.) are included in the list.
If it is set to Select automatically, the system selects the client type depending on
the Default run mode configuration property value and Run mode property value
for the user starting up 1C:Enterprise. If no particular value is specified in the
configuration and user properties, the following criteria are applied:
If Default run mode is Ordinary application, the system runs thick client in the
ordinary mode.
If Default run mode is Managed application, the system runs thin client.
If the user wants to pick a specific client to run when 1C:Enterprise is started up
in the Designer, it has to be done manually (items below Select automatically).
If the web client has been selected to run, the Web browser to be used can also be
indicated:
Default
Microsoft Internet Explorer
Mozilla Firefox
Google Chrome
Safari
When the web client is launched from the Designer, the system checks version of
the platform that has had an infobase previously published. If versions differ, the
2-1156 1C:Enterprise 8.3. Developer Guide
user is prompted to run publication again. Affirmative answer initiates an infobase
publication dialog box (for details see "1C:Enterprise 8.3. Administrator Guide").
The User group determines the user on behalf of whom 1C:Enterprise is started
when it is started in the Designer:
Current – from the user list.
Name – a specific user is designated (same as the /N command line option).
There is the ability to select a user from the list. The "..." button in the right
side of the field is used for this purpose.
Use operating system authentication – if this option is checked, user is selected
using OS authentication (same as the /WA command line switch).
Data split – specifies separator values as they are specified for the -Z option (for
more details see page 2-911). A string specified in this field should match the
rule of specifying separator values, but it should not include quotes around values
when they are specified in the /Z option. For example, when the following option
is specified in the command line: /Z "-1,+4", in the Data split you should specify
-1,+4. The system remembers different variants of separator values entered and
allows you to switch between them.
Startup option – launch parameter (same as the /C command line switch) that can be
edited via the LaunchParameter global context property.
Slow connection – enables or disables low speed connection mode when launching
thin client. The check box status is saved for a specific infobase. If run mode with
low connection speed is not set for an infobase in the infobase list, the check box
is displayed as unset. If the check box is selected, 1C:Enterprise runs with low
speed.
If run mode with low connection speed is set for an infobase in the infobase list,
the check box is displayed as grey. If the check box is not selected, 1C:Enterprise
runs with normal speed. The check box has the same function as the -O command
line switch.
Emulate delay on server calls – this check box enables imitation of thin client
operation with significant delays in interaction with the server. By default
it is unchecked.
Call delay (seconds) – defines delay duration for each server call by the client
application.
Data sending delay (seconds/Kb) – defines delay duration for data transfer to the
server. The time value is indicated per 100 bytes of transferred data.
Data receiving delay (seconds/Kb) – defines delay duration for data retrieval from
the server. The time value is indicated per 100 bytes of retrieved data.
NOTE
Default values allow emulating GPRS connection.
Chapter 31. Service Features 2-1157
Server call delay mechanism can also be enabled using the command line: -Emula-
teServerCallDelay [-CallXXXX] [-SendYYYY] [-ReceiveZZZZ], where:
-EmulateServerCallDelay – command line switch that enables the delay imita-
tion mechanism for server calls;
-Call – parameter indicating delay duration for a server call in milliseconds
(if no value is specified, the delay is 100 ms);
-Send – parameter indicating delay duration for data transfer (if no value
is specified, the delay is 100 ms);
-Receive – parameter indicating delay duration for data retrieval from server
(if no value is specified, the delay is 100 ms).
Service messages file – if it is necessary to auto-save service messages to a file,
specify its name in this parameter (same as the /OUT command line switch).
Do not clear file before startup – if the check box is set, at the next startup messages
will be added to the file specified (same as the /OUT command line switch with the
NoTruncate key).
2-1158 1C:Enterprise 8.3. Developer Guide
For a detailed description of the server call display mechanism see page 2-1057.
Display All Functions command – displays the Main Menu – All functions menu item
(see fig. 506). Invocation of this command displays a form with a list of all appli-
cation objects available to the user (used in managed mode of thick client as well
as thin and web clients). By the default this menu item is disabled (it is the same
as the /DisplayAllFunctions command line switch).
Chapter 31. Service Features 2-1159
NOTE
Forms opened from the All functions window always appear in an auxiliary appli-
cation window.
The All functions window also provides access to Standard functions used for
standard procedures: viewing the list of active users, deleting marked objects, etc.
For a detailed description of standard functions see "1C:Enterprise 8.3. Adminis-
trator Guide".
The Automated testing group defines the role (in terms of automated testing; for
details, see page 2-1060) for the client application launched from Designer:
Do not use – the launched client application is not included in automated
testing;
Run as testing manager – the launched client application is used as the testing
manager (the TestManager command-line parameter is used);
Run as testing client – the launched client application is used as the
testing client (the TestClient command-line parameter is used); the port
specified in the Port number for thin and thick clients parameter is used for
communicating with the testing manager (TPort option for the TestClient
command-line parameter). For the web client, the ID specified in the Identifier
for web client option is used (TestClientID command-line parameter).
31.2.5. Help
Use this tab to configure the viewing mode of the Help content (see fig. 507).
Help content can be displayed in one window or split into several independent
windows (Display in a single window/Display in multiple Windows parameters).
The Syntax Assistant window can be placed horizontally or vertically (Arrange
horizontally/Arrange vertically parameters) and use two languages for terms (Use
both languages parameter).
2-1160 1C:Enterprise 8.3. Developer Guide
The user can set up filtering by object availability for tree contents and Syntax
Assistant index display for a particular 1C:Enterprise run mode. Thus, Syntax
Assistant sections can be displayed only for objects available in the thin client.
This tab can also be accessed using a command bar button in the Syntax Assistant.
31.3. CALCULATOR
For help with calculator features see the "Calculator" section in the User Manual.
31.4. CALENDAR
For help with calendar features see the "Calendar" section in the User Manual.
Use the Use standard templates check box to add standard templates. Deselecting
this check box disables standard templates altogether. Each 1C:Enterprise version
uses its own set of standard templates. User templates can be attached in addi-
tion to standard templates. To do this, click the Add button on the toolbar of the
Template Setting window and select the required template file.
TIP
It is recommended to store user templates in a directory different from the
1C:Enterprise installation directory. For example, templates might be saved in a
special subdirectory of the My Documents directory.
Use the Move up and Move down buttons to rearrange files within the list.
To remove an unwanted template select it in the file list and click the Delete
current item button.
IMPORTANT!
Standard templates cannot be edited. They can only be viewed in the template
editor.
Chapter 31. Service Features 2-1163
The Name attribute shows the name of a template in the list of templates. Use the
Automatically replace string attribute to specify the line sequence to be replaced
with template text when typing. Replacement is initiated by hitting Spacebar or
Enter key.
Additionally when the user types in a template name, a tooltip with template text
is displayed on the screen as shown below.
The template editing window contains a toolbar that can be used to create template
groups and separate templates, remove redundant templates and sort lists. The left
part of the window contains a tree of templates. In the right part, you can edit
names of template groups and the template itself.
Templates can be grouped into folders for convenience. Use the Add Folder
command from the context menu or the appropriate toolbar button to create
a group. Enter a group name in the Name attribute.
To create a template select the group where it is to be located and use the Add
command from the context menu or the appropriate toolbar button. The Name
attribute contains the template name (this name is used to select a template for
inserting into edited text). Use the Automatically replace string field to specify the
first part of the string that will be replaced with template text in a text document
window (if automatic substitution is turned on). Automatic substitution occurs
when the user presses Enter or Spacebar after entering a sequence of characters.
Use Template text multi-line field to enter text to replace the Automatically replace
string field value or to be inserted into a document when a template is selected.
To make a template available for interactive selection, check the Include in context
menu option.
In this case a template to be inserted in text (module) can be selected from the list
of templates in the context menu. Templates are placed in the list if the Include
in context menu option is checked.
Syntax:
<?"Tooltip">
Parameters:
<Tooltip>
Explanatory label text.
Cursor Positioning
Description:
This construct is used for placing the cursor to the indicated location after
inserting text into the template.
Syntax:
<?>
Special Query
Description:
This construct is used for entering configuration objects, predefined items and
other data.
Syntax:
<?"Tooltip",<Keyword>[, <Parameter1>[,<Parameter2>…]]
Parameters:
<Tooltip>
Explanatory text in the entry query.
<Keyword>
Type of query.
<Parameter1>…
Query parameters.
Chapter 31. Service Features 2-1165
Place the cursor in the template area that contains a variable part and click the
<->Insert… button. The Insert Control Directive dialog box is displayed.
Chapter 31. Service Features 2-1167
The Tooltip attribute is used to specify a line of text that will be entered as an
explanation to an action that is performed when a context-dependent part of
a template is requested. Since a template can contain several control directives
that can be entered in a sequence, this text explains the required actions and the
location of the variable part.
Click radio buttons to select the type of control directive for insertion.
Custom query is used to enter free-form text. In this case template text contains
a control directive that looks like <?"Tooltip text">.
A Custom query control directive is used as follows. If the replacement text
contains a <?"Tooltip text"> construct, a request with tooltip text and a text
box is displayed before the replacement text is inserted. Specify the text for inser-
tion in the text box in place of the <?"Tooltip text"> construct. There may be
several Custom query constructs in a replacement text and some constructs may
have the same tooltip text. A specific text request is provided for each construct
when replacement text is inserted. There will be one common query for all iden-
tical constructs and the text in the query will replace all identical constructs.
Specific query is used to select configuration objects. To place a configuration
object into the type selection control directive template using the Insert Control
Directive window, enter the query name in the Tooltip field and select the directive
from the list (selection of configuration object, predefined configuration object item
or special directive), e.g., Catalog.
When such a template is used, a list of possible configuration objects is displayed
on the screen. The name of a selected object replaces the entered text. Position
of the selected line is memorized and the list is positioned on this line when this
template is selected again.
Other possible values for a specific query include a switch. When a template with
this type of query is generated and you click OK, a window with possible values
is displayed.
2-1168 1C:Enterprise 8.3. Developer Guide
Use the Tooltip column to insert text to be placed in the selection list when this
template is used. Use the String to insert column to enter text for insertion into text
document.
The list can only be edited in the template text. When directive insertion is invoked
again, a new directive is added.
When you press OK, a control directive is inserted into the template text.
Select this template in the template tree (or during automatic substitution).
Position cursor – is used for placing the cursor to the indicated location after
inserting text into template. The <?> construct is inserted into replacement text of
the template. This construct specifies where the cursor is moved to when replace-
ment text is inserted. If there are several constructs of this type in the replacement
text, the cursor is placed into the first <?> construct.
When writing template texts, multiple occurrences of control directives as well as
use of existing templates is allowed.
2-1170 1C:Enterprise 8.3. Developer Guide
The user can set up filtering by object availability for tree contents and Syntax
Assistant index display for a particular 1C:Enterprise run mode.
Chapter 31. Service Features 2-1171
The Syntax Assistant window is a standard hierarchical data window with a tree
and you can work with it in a standard way. To open a branch use the "+", "-" and
"*" keys of the numeric keypad. The "+" key expands one level of a branch, the
"-" key collapses a level and the "*" key expands all child branches of the current
branch.
To get a description select the name of a 1C:Enterprise script item in the upper
part of the Syntax Assistant window. The item description is displayed in the
lower part of the window. This description may contain links to descriptions of
referenced 1C:Enterprise script items.
The window contains a toolbar that can be used to view history of previously
selected descriptions.
To display location of the item whose description is currently displayed in the
lower part of the window in the structure of the 1C:Enterprise script items, click
the Find current element in the tree button in the toolbar.
If the found item is used in several objects, the Select topic window will open.
This window contains a list of entries for the selected item.
Now, if you press the Show button, a description of the found 1C:Enterprise script
item from the window of entries is shown in the Syntax Assistant window.
TIP
If the Select topic window contains a lot of lines (see fig. 523), press Ctrl+F and
enter the name of the searched object in the search dialog box. Thus, search of the
required topic can be accelerated.
2-1174 1C:Enterprise 8.3. Developer Guide
You can search for a 1C:Enterprise script item description in the Syntax Assistant
during module editing. To perform a search place the cursor over the item for
which you need to find description or select a text block and press Ctrl + F1.
If the word on which the cursor is placed or the selected text block is a
1C:Enterprise script item described in the Syntax Assistant, the Syntax Assistant
window will open immediately with this item description.
If a 1C:Enterprise script item is described in several sections of the Syntax Assis-
tant, the Select topic window will open so that the required section can be selected.
If the selected word or text block is not a 1C:Enterprise script item, the context
search window will open in the Syntax Assistant when you press Ctrl + F1.
Each search is memorized in a list that can be called in the Name text box.
To view a topic select it from the list and press Enter. Description of the selected
topic is shown in the lower part of the window.
Searches using random description text are performed in the Search tab of the
Syntax Assistant window. The upper part contains a box for entering the search
string and a box with a list of 1C:Enterprise script item description topics found.
To begin the search start typing the text. While you are typing, the system
searches for topics where the entered text is present. Search is not case-sensitive;
only whole words of the text are matched (unless the "*" operator is used), with
morphology taken into account. Search operators are allowed (see page 2-1207).
While you enter the text, the program displays a list of corresponding topics.
If the entered text is not found anywhere, the program displays appropriate
message below the text box.
When you open a topic, the program shows the description in such a way that the
first occurrence of the specified text is visible.
To view a topic select it from the list and press Enter. Description of the selected
topic is shown in the lower part of the window.
When the chapter with the description of the 1C:Enterprise script item has been
found and the Syntax Assistant window is open, use the Find current element
in the tree button in the command bar to search for the chapter in the description
tree.
If you select several pages for viewing, you can use the Go forward and Go back
commands to return to previously viewed pages.
For a description of search expression syntax see page 2-1207.
In the Compare and With fields, specify names of the files to be compared. File
names can be entered manually or selected from the dropdown list or from the
standard file opening dialog by clicking the selection button (…). You can specify
any type of source file in the File Type field of the dialog box.
Use the As field to specify how the files are to be compared. You can compare text
and spreadsheet documents as well as external data processors. You can also use
binary comparison to compare files on the binary level. In this case the results will
tell you whether or not the files are different from each other.
If files of different types are specified in the Compare and To fields, the selected
files are cast to the type specified in the As field. Then the actual comparison
is performed and comparison results are displayed.
Click OK to start the comparison process.
If you select Text document comparison type, the selected documents will be inter-
preted as text documents for comparison, although the Compare and With fields
2-1176 1C:Enterprise 8.3. Developer Guide
can contain non-text files (according to file extensions). If any of the specified files
cannot be interpreted as a text file, binary comparison is performed.
ADD-INS
Add-ins obtained from the configuration or infobase are saved and used in subse-
quent connections without the need to retrieve them again (if an add-in is used at
the server, it is only saved for the server working process lifetime).
NOTE
The external СОМ components connection using the LoadAddIn(), AttachAd-
dIn() methods and component object registration are performed "for user".
If "for user" registration fails, an attempt to perform "for computer" registration
will be made.
If an add-in is enabled using the AttachAddIn() method, the parameter in the
New() operator (of the created type name) includes the following:
Addin. text
Name specified in the Name parameter of the AttachAddIn() method
Name of the object implemented in the add-in
If a Timer object is implemented in the add-in and the latter is attached using
AttachAddIn(URL, "MyName");, creating an object from the add-in requires
entering the following ID: New("Addin.MyName.Timer").
Add-in file is saved by workflow until restart; therefore, re-attachment of add-in
(before workflow restart or switch to another workflow) takes less time than the
initial attachment.
Else
AddInObject = New("AddIn.MyName.ComponentExtension");
NOTE
Please note how parameter in the New command is generated.
Chapter 32. Add-Ins 2-1181
Else
AddInObject = New("AddIn.MyName.ComponentExtension");
NOTE
Please note how parameter in the New command is generated.
Var Ref;
Else
AttachAddIn(Ref,"MyName", AddInType.Native);
AddInObject = New("AddIn.MyName.ComponentExtension");
2-1182 1C:Enterprise 8.3. Developer Guide
NOTE
Please note how parameter in the New command is generated.
Using examples for Native API add-ins the user can also attach COM add-ins for
Windows OS only.
NOTE
Please note how parameter in the New command is generated.
NOTE
LoadAddIn() command is used for compatibility with previous 1C:Enterprise
versions.
Chapter 33
SPECIFICS
OF CROSS-PLATFORM APPLIED
SOLUTION DEVELOPMENT
(/temp/file.txt in Linux) points to the exact file location and name in Linux:
it is a file named file.txt and located in the temp directory of the root file
system. In Windows OS identification is not unique. This path indicates that
a file named file.txt is located in the temp directory of the root directory on the
current drive. Moreover, the current drive may be different for two subsequent
launches of the same client application with the same infobase.
When you develop applied solutions, you should remember that Windows and
Linux use different path separators. Windows uses "\" ("back slash"), whereas
Linux uses "/" ("forward slash"). If you work with the 1C:Enterprise script methods,
you do not have to take this difference into account, since these methods work
correctly with any separator. However, if you need to pass the path to an external
application, you should enter the path separators used in the operating system
where 1C:Enterprise is running. You can obtain information on path separators
using the following functions: GetPathSeparator(), GetClientPathSepa-
rator(), GetServerPathSeparator().
In addition to using different path separators, Windows and Linux process
file masks differently. For example, the *.* mask indicates retrieval of all files
in Windows and retrieval of all files containing the period (".") in their names
in Linux. This difference may cause the 1C:Enterprise script methods Find-
Files(), DeleteFiles() and the FileDialog object to behave in unexpected
ways. The specifics of using file masks in different operating systems are
described in the Syntax Assistant for FindFiles() and DeleteFiles() func-
tions. You can obtain a file mask retrieving all files using the following functions:
GetAllFilesMask(), GetClientAllFilesMask(), GetServerAllFilesMask().
In addition, in Linux you cannot access network resources using UNC notation
(in this case, an address would look like: \\server\folder\folder\file.ext). Therefore,
if you need to use an external network resource, you should first mount it to the
root file system. You should also remember that you can use a different mounting
point (directory) every time. You can also access external network resources using
special applications (such as smbclient), but you should remember that these appli-
cations may be missing in the installation of Linux you are using.
For more detailed information about the Linux file system and how to use it, see the
Linux documentation or internet resources.
33.4. FONTS
When you develop applied solutions, it is recommended you always use style
fonts without explicitly specifying the typeface. If required, you can use fonts
included in Microsoft Core Fonts (http://sourceforge.net/projects/corefonts/). We recom-
mend that you do not use other fonts in applied solutions, as these fonts may be
unavailable in some operating systems, and the appearance of the applied solution
would be distorted.
33.5. HTMLDOCUMENTFIELD
In 1C:Enterprise running on Linux, WebKit is used to work with HTML.
In 1C:Enterprise running on Windows, the current version of Internet Explorer
is used to work with HTML. Therefore, you should remember the following when
you work with HTML:
An HTML document can be displayed differently in different operating
systems.
If you access the DOM-model of an HTML document using the HTMLDocu-
mentField.Document property, you should only use properties and methods
available in all web browsers that are supported by 1C:Enterprise. This is both
due to the use of various tools for displaying HTML documents in client appli-
cations as well as due to the fact that web access may be used to work with the
applied solution, increasing the number of web browsers and their versions.
2-1186 1C:Enterprise 8.3. Developer Guide
URL FORMATS
This Appendix describes link formats used in 1C:Enterprise. Links can be external
or internal. External links are used outside 1C:Enterprise, while internal links are
used internally (e.g., for placement into favorites list or operation history).
These links can reference infobase objects, reports, data processors, sectionsections
or section commands.
If a link designates a resource, an external link is generated as shown below:
<IB host address>/<internal link>
These links can reference infobase object attributes or information register entries
or temporary storage.
TIP
If multiple clients are used to work with the infobase, it is not recommended
to save external links to infobase objects as it might render links created in one
client inoperable in other clients. For example, an external link created in a web
client could fail in a thin client directly connected to the 1C:Enterprise server.
It is recommended to save internal links.
If an external reference that has the e1cib signature in its path is passed to the
GotoURL() method or a URL dialog, and the reference beginning does not match
with an infobase URL, internal reference is extracted from the passed URL and
an attempt to go to the extracted part is made. If the attempt fails, the full URL
is navigated.
Example:
// Infobase file path
{0>\\dbsrvr\bases\mybase<}0{>\\dbsrvr\bases\mybase
// Host address
e1c:/file/dbsrvr/bases/mybase
If the file path includes the drive letter, host address looks like the following:
e1c:/filev/<Drive letter>/<Base path>
Example:
// Infobase file path
{0>s:\bases\mybase<}0{>s:\bases\mybase
// Host address
e1c:/filev/s/bases/mybase
Appendix 1. URL Formats 2-1189
Example:
// Infobase connection string
srvsr="srv1C";ref="mybase"
// Host address
e1c://server/srv1C/mybase
Example:
// Infobase connection string
http://localhost/mybase
// Host address
http://localhost/mybase
Where:
Metadata path – type of object referenced by the link, e.g., Document.Go-
odsConsumption.
Link ID – unique object identifier in the infobase.
2-1190 1C:Enterprise 8.3. Developer Guide
Where:
Metadata path – type of object referenced by the link, e.g., Document.
GoodsConsumption.
Attribute name – name of infobase object attribute.
Link ID – unique object identifier in the infobase.
Where:
Metadata path – type of object referenced by the link, e.g., Document.
GoodsConsumption.
Tabular section name – name of metadata tabular section, e.g., Goods.
Attribute name – name of infobase object tabular section attribute.
Link ID – unique object identifier in the infobase.
Tabular section row index – index of tabular section row.
Where:
Metadata path – type of object referenced by the link, e.g., InformationReg-
ister.ProductInventory.
Key field name – name of register dimension (Period dimension is added for
periodic registers).
Value is an internal presentation of a filter value. A filter value is coded as
described in section 2.2. URL Character Encoding Issues compliant with the
RFC 1738 standard (http://www.faqs.org/rfcs/rfc1738.html) – with the help of the %
symbol and two hexadecimal characters.
Appendix 1. URL Formats 2-1191
Where:
Metadata path – type of object referenced by the link, e.g., InformationReg-
ister.ProductInventory.
Attribute name – name of record attribute.
Key field name – name of register dimension (Period dimension is added for
periodic registers).
Value – internal presentation of filter value.
Where:
Metadata path – type of object referenced by the link, e.g., Report.Pro-
ductInventory.
Where:
Metadata path – type of object referenced by the link, e.g., DataProces-
sor.OrderIssue.
Where:
Section name – name of top-level subsystem referenced by the link, e.g.,
Goodsales.
2-1192 1C:Enterprise 8.3. Developer Guide
Where:
Section name – name of top-level subsystem referenced by the link, e.g.,
Goodsales.
Command name – name of command. E.g. Catalog.Products.OpenList.
Where:
Temporary value ID – identifier of temporary value.
Where:
Metadata path describes an external data source table, for instance Exter-
nalDataSource.Receipts.Table.CheckHeaders.
Key field name is a key field name of an external data source table.
Value is an internal presentation of a filter value. A filter value is coded as
described in section 2.2. URL Character Encoding Issues compliant with the
RFC 1738 standard (http://www.faqs.org/rfcs/rfc1738.html) – with the help of the %
symbol and two hexadecimal characters.
Where:
command name is the command name:
○○ standard command is Catalog.Goods.Create;
Appendix 1. URL Formats 2-1193
Where:
list name is the name of the list being opened, e. g. Catalog.Goods.Docu-
ments.GoodsConsumption.
To ensure that object presentation can be overridden (or adjusted) in the interface,
a special set of properties has been introduced in metadata properties.
(for register – record presentation)
Object presentation
Object
List presentation
Explanation
Picture
Subsystems + +
Constants + +
Exchange Plans + + + + +
Filter Criteria + + +
Common Forms + +
Constants + +
Catalogs + + + + +
Documents + + + + +
Document Journals + + +
Enumerations + + +
2-1196 1C:Enterprise 8.3. Developer Guide
Object presentation
Object
List presentation
Explanation
Picture
Reports + +
Data Processors + +
Charts of Characteristic Types + + + + +
Charts of Accounts + + + + +
Charts of Calculation Types + + + + +
Information Registers (subordinate) + + +
Information Registers (independent) + + + + +
Accumulation Registers + + +
Accounting Registers + + +
Calculation Registers + + +
Business Processes + + + + +
Tasks + + + + +
When generating presentation for standard commands (and their tooltips) the
system applies the following rules (Property1 → Property2 means that if Property1
is not specified, Property2 is used instead):
Opening a list:
○○ Command presentation: List presentation.
○○ Command tooltip: Explanation → Extended list presentation → List presen-
tation.
Creating a new object (record):
○○ Command presentation: Object presentation: Create or Record presentation:
Create.
○○ Command tooltip: Extended object presentation (Extended record presenta-
tion) → Object presentation (Record presentation).
Creating a new folder:
○○ Command presentation: List presentation: Create Folder.
○○ Command tooltip: Extended object presentation → List presentation.
Navigating to any subordinate list (Go To folder command in form navigation
panel):
○○ Command presentation: List presentation.
Appendix 2. Rules for Generating Standard Commands and Automatic Form Headers 2-1197
When auto-generating form headers the system applies the following rules:
List form header: Extended list presentation → List presentation.
○○ Form header for catalog, chart of accounts, chart of calculation types,
exchange plan, chart of characteristic types and task:
□□ Existing item: text presentation of object (Extended object presentation
→ object presentation), e.g.:
• Zinovyev Anton (Employee).
• 70.1 (Account).
○○ New item: Extended object presentation (Creation) → Object presentation
(Creation).
Document or business process form header:
○○ Existing item: text presentation of object, e.g.:
□□ Receipt # 12001 from 05/12/2008 16:15:32.
○○ New item: Extended object presentation (Creation) → Object presentation
(Creation).
Information register record form header:
○○ Existing record: Extended record presentation → Record presentation.
○○ New record: Extended record presentation (Creation) → Record presenta-
tion (Creation).
Form header for catalog folder or chart of characteristic types:
□□ Existing folder: text presentation of object (Extended list presentation →
List presentation).
□□ New folder: Extended list presentation (Folder Creation) → List presen-
tation (Folder Creation).
Report or data processor form header: Extended presentation.
NOTE
If none of the properties used in header generation is specified, text presentation
of metadata object is used as it is returned by the Presentation() method.
Appendix 3
LIST OF AUTO-SAVED
SETTINGS
This appendix describes settings auto-saved in the system storage by the platform.
Saved value type – Map. Map key is path to saved data attribute and its
value is attribute value.
System Repository
Settings: Current Report Variant Key
Object key – text string including full report name and /CurrentVariantKey
string. An example of an object key:
Report.Sales/CurrentVariantKey
If the PurposeUseKey property is set for a form, an object key is generated
as follows: the full report name, /, report variant key as a string, /, Purpo-
seUseKey property value and /CurrentUserSettingsKey string.
An example of an object key:
Report.Sales/SalesByRegion/ForDiscountChargeForm/CurrentUserSettingsKey
In this example, the report variant key is set to SalesByRegion, and the Purpo-
seUseKey property is set to ForDiscountChargeForm.
Setting key – empty string.
Saved value type – any value containing the current variant key.
If the PurposeUseKey property is set for a form, an object key is generated
as follows: the full report name, /, report variant key as a string, /, Purpo-
seUseKey property value and /CurrentUserSettings string.
An example of an object key:
Report.Sales/SalesByRegion/ForDiscountChargeForm/CurrentUserSettings
In this example, the report variant key is set to SalesByRegion, and the Purpo-
seUseKey property is set to ForDiscountChargeForm.
Setting key – empty string.
Saved value type – DataCompositionUserSettings.
2-1202 1C:Enterprise 8.3. Developer Guide
If the PurposeUseKey property is set for a form, an object key is generated
as follows: the full form name, /, PurposeUseKey property value and /Current-
Data string.
○○ MainSection/NavigationPanel/CommandInterfaceSettings – navigation
panel settings (in compatibility mode older than version 8.3.2)
Example:
Subsystem.Sales/NavigationPanel/CommandInterfaceSettings
Desktop/ActionsPanel/CommandInterfaceSettings
FULL-TEXT SEARCH
EXPRESSIONS
You can search by several words, exact phrases or using search operators.
By default synonym-based search and fuzzy search are not used. To perform
searches of these types use the appropriate operators.
The following search operators can be used in the input string (both for Help/
Syntax Assistant search and for 1C:Enterprise script FullTextSearch object):
Operator Sample Expression Explanation
Space Business Success Both "Business" and "Success" must be included
AND Business AND Success
AND Business AND Success
& Business & Success
OR Business OR Success Either "Business" and "Success" must be included
OR Business OR Success
| Business | Success
, Business , Success
NOT Business NOT Success "Business" must be included, while "Success" must not
NOT Business NOT Success
~ Business ~ Success
NEAR/[±]n Example 1: Searches for data that have the specified words in the same
NEAR/[±]n drier NEAR/3 air attribute (with account taken of morphology) separated by n
Example 2: words.
drier NEAR/+3 air The sign determines where the second word should be
Example 3: located with respect to the first word (+ – after the first word;
drier NEAR/-3 air - – before it).
If no sign is specified, the search returns data that contain
the words separated by n words. Their order is not important.
Example 1 returns data with "air" separated from "drier" by
a maximum of 3 words and located before or after "drier".
Example 2 returns data with "air" separated from "drier" by
a maximum of 3 words and located after "drier".
Example 3 returns data with "air" separated from "drier" by
a maximum of 3 words and located before "drier".
2-1208 1C:Enterprise 8.3. Developer Guide
The AND or, NOT and NEAR operators must be entered in upper case only. Operators
must not be used on their own (at the beginning of the search string). For example,
it is not possible to select all the chapters without the specified text. All the char-
acters in the search box except for search operators, letters and digits are ignored.
When using 1C:Enterprise script FullTextSearch object please remember the
following:
Operator Sample Expression Explanation
* arch* Searches using a wildcard – only one "*" character
arch* & docfl* is supported and should be added to the end of the word.
Thus, "arch*" query can find "archive" and "archeology"
# #System Fuzzy search for words with the number of differences
System#2 specified in the search box.
"#System" query (equivalent to "System#1") can return
"sustem" or "syxtem".
"System#2" query can return "suxtem" or "syytem".
It can only be used in full-text search
! !red tile Search is performed using synonyms in English, Russian
and Ukrainian. "!" operator precedes the relevant word.
Example: "!red tile" query finds "scarlet tile" and "coral tile"
as well
The AND or, NOT and NEAR operators must be entered in upper case only. Operators
must not be used on their own (at the beginning of the search string). For example,
it is not possible to select all the chapters without the specified text.
To look up special characters used in texts enclose them in quotation marks.
Example: "NEAR".
Appendix 5
DESCRIPTION
OF ACCESS RIGHTS
This annex describes all the access rights that can be managed when you edit roles
in 1C:Enterprise.
Automation – using the automation server.
Administration:
○○ Administrative rights for the whole infobase and user list editing
(the configuration right). Requires DataAdministration.
○○ An ability to configure connection options (for an external data source).
○○ Display of licenses, that were used when operating with the configuration
and infobase, in the About 1C:Enterprise window.
○○ Deleting data areas (including the deletion of all the areas at once).
○○ An ability to execute background database configuration update on the
client side.
DataAdministration – this right regulates administrative actions with data.
These actions include:
○○ viewing event log records and getting filter values without restrictions.
○○ setting the infobase (data area) time zone (calling the SetInfoBa-
seTimeZone() method).
○○ Creating an initial image for the distributed infobase subordinate node
(calling the CreateInitialImage method).
○○ Refreshing object numbering (calling the RefreshObjectsNumbering()
method).
○○ Executing the StandardSettingsStorageManager object method,
if non-current user settings are processed.
ActiveUsers – view the list of active users.
2-1210 1C:Enterprise 8.3. Developer Guide
○○ Window settings (size and position) are saved only during the session.
○○ Main window panel size settings are saved only during the session.
○○ When settings are programmatically saved, an exception is raised.
○○ Client application settings are saved only during the session. The Allow
debugginf on startup checkbox is not shown (for a thin client and a thick
client). The Slow connection checkbox is not shown (for a web client).
○○ Period settings in the list are not saved. The Use this period next time
the form is opened checkbox is not available in the period configuration
dialog.
Start – the right to start a business process.
ThickClient – the right to start a thick client.
ThinClient – the right to start a thin client.
Delete – deletion (main).
TotalsControl – controlling accounting register totals and accumulation
register totals (setting the period until which totals are calculated and totals
recalculation).
Set – setting a value which is not saved in the database.
Read – reading (main).
Appendix 6
SYSTEM BEHAVIOR
IN VARIOUS MODES
When a template is received on a server and in an external connection, the
default configuration language is set as the template language.
The Data Path property of the data composition template user field is generated
in English.
When a normal form of an information register record is opened, the Period
property value is set to the current data, but only if this property is not filled
and the form record is opened from a list form. For all other cases, this prop-
erty is not populated.
Contents of tables describing scheduled jobs are changed:
○○ Compatibility mode is used – all scheduled jobs are stored in one table.
○○ Compatibility mode is not used – each scheduled job is stored in a sepa-
rate table.
Contents of tables storing constants is changed:
○○ Compatibility mode is used – one table is used to store constants.
The same table is used to register changes.
○○ Compatibility mode is not used – each constant is stored in its own table.
Changes for each constant are also registered in a separate table.
Contents of tables storing accumulation register settings are changed:
○○ Compatibility mode is used – accumulation register settings are stored
in one table.
○○ Compatibility mode is not used – the settings of each register are stored
in a separate table.
Contents of tables storing accounting register settings are changed:
○○ Compatibility mode is used – accounting register settings are stored in one
table.
○○ Compatibility mode is not used – the settings of each register are stored
in a separate table.
Help inclusion by a subsystem in help system contents was changed:
○○ Compatibility mode is used – subsystem help was shown in help contents,
if for any object included in the subsystem, the Include in Help Contents
property was set and it was disabled for the subsystem.
○○ Compatibility mode is not used – inclusion of subsystem help in help
contents completely depends on the Include in Help Contents subsystem
property status and does not depend on the properties of the objects included
in the subsystem.
A number of resources shown in a diagram by the data composition system has
changed:
○○ Compatibility mode is used – only one resource (the first one) is shown
in the diagram.
○○ Compatibility mode is not used – several resources are shown in the
diagram.
2-1218 1C:Enterprise 8.3. Developer Guide
Outputting data composition results to the collection of values when one data
composition field is included in different groups:
○○ If the compatibility mode is used, different group fields that reference to the
same data composition field were included in different collection columns.
○○ If the compatibility mode is not used, different group fields that reference
to the same data composition field were included in different collection
columns.
Generating an custom data object presentation:
○○ If the compatibility mode is used, generating custom presentations is not
supported.
○○ If the compatibility mode is not used, generating custom presentations
is supported.
To obtain a value for the functional option, if this value is set to be received
in privileged mode:
If compatibility mode using version 8.3.2 is used – an error is generated
in safe mode if you do not have access rights to an object storing the functional
option value.
○○ If compatibility mode is not used – rights are not verified.
If a user minimizes a form of the modified object in Google Chrome and then
closes the main application window, the system warns that some data has not
been saved, but the form with this data will not be activated.
Sometimes in Internet Explorer 6.0 and Google Chrome, an empty window can
be shown when receiving a file from a server.
If you need to display form element text normally when specifying the font size,
you should specify both the font size and type of the TrueType font used.
If button height is more than 5 units (with the standard font size), the button
is shown without gradients.
If the Question() global context function button list does not contain a button
with the DialogReturnCode.Cancel function, an attempt to close the dialog
using the system Close Window button (the cross in the top right form corner)
will reopen the dialog.
Status bar functionality is limited. When a module is running, status updates
depend on the Web browser (for details see page 1-351).
The indicator field display differs from a thin client. In particular, this concerns
the appearance of an indicator field for which the Representation property
is set to Broken or BrokenTilt.
Dendrogram object functionality is limited.
GraphicalSchema object functionality is limited.
GeographicalSchema object functionality is limited.
GanttChart object has limited interactive setup features.
Retrieval of system information about client computer is not supported.
Work with TextReader, TextWriter, ZipFileReader, ZipFileWriter and
XBase objects is not supported. It is recommended to work with these files on
the server side.
Work with XML and XDTO is not supported. It is recommended to work
with these files on the server side.
Internal clipboard is implemented in Google Chrome and Safari browsers:
○○ Data in the internal clipboard are relevant during the session.
○○ All values in the operating system clipboard are also duplicated in the
internal clipboard.
○○ The M+ and M- commands change the value in the internal clipboard.
The result is written to the operating system clipboard.
○○ The internal clipboard is shown in the "1" cell in the calculator, and the
MR, M+ and M- calculator commands work with internal clipboard values.
The result is written to the operating system clipboard.
The calculator configuration dialog is not supported.
The functionality of the interactive spreadsheet change is restricted.
Appendix 6. System Behavior in Various Modes 2-1223
In Google Chrome and Safari, a border can be shown incorrectly with a certain
combination of cell groups and cell frames in a spreadsheet document.
For two adjacent (horizontally) spreadsheet document cells, the contiguous
border will be decorated with the same line that is used for the right border of
the left cell if the document is displayed in Microsoft Internet Explorer 6.0.
The following line types are only available for spreadsheet document cells:
Solid, Dotted and None. Other line types are replaced with the available types
as follows:
○○ Double line type is replaced with Solid;
○○ ThinDashed, ThickDashed and LargeDashed line types are replaced with
Dotted.
In Microsoft Internet Explorer and Google Chrome, the dotted frame of adjacent
cells can sometimes be displayed as a solid frame.
To ensure spreadsheet documents with dotted lines are correctly printed from
the Google Chrome web browser, we recommend you set the PrintAccuracy
property for these documents to Accurate. Similarly, this recommendation
applies if you use Google Chrome to print spreadsheet documents and want to
ensure that accurate dimensions are used for all printed items.
File comparison mode is not supported.
Recently used file list is not supported.
Files cannot be dragged and dropped to web client forms.
Web clients use a limited set of fonts available in OS in use. Other fonts
cannot be selected in the font selection dialog box in the web client; if used
they are replaced with supported fonts.
The main menu can be accessed by pressing F10; access by pressing Alt once
is not supported.
Pressing Ctrl + W in Google Chrome closes auxiliary windows and does not
select a word.
Pressing Ctrl + F4 in Google Chrome closes the current tab. If the tab is the last
tab, the next browser window is closed.
Pressing Ctrl + N in Google Chrome creates a new browser window and does
not open the New Document menu.
Web browsers do not support scaling (other than 100%) or non-standard DPI
settings.
Navigation between windows using the keyboard can have special characteris-
tics (depending on Web browser type):
○○ Microsoft Internet Explorer 6.0 – no special characteristics.
○○ Microsoft Internet Explorer 7, Microsoft Internet Explorer 8 – navigation
using Ctrl + Tab and Ctrl + Shift + Tab is not supported if tabs are enabled
in the Web browser. Navigation using F6 and Ctrl + F6 is available with no
constraints.
Appendix 6. System Behavior in Various Modes 2-1225
When the PutFile() method is called, there could be situations when put
file errors are determined incorrectly. In this case True is returned and the
Address parameter does not contain a temporary storage address.
Size modification mode (using the mouse) for a calendar opened from a text
box is not disabled if the mouse button is released outside the window where
the calendar is opened. To disable size modification mode click the left mouse
button again and release it inside the calendar window.
In Safari, the calculator and calendar windows are always opened in windows,
which size is not less than the minimal window size for that browser.
Scroll bar color for HTML document field matches OS color, except the cases
when Microsoft Internet Explorer is used and HTML document field displays
HTML page set by a text string.
Calling the DocumentComplete and OnClick event handlers and Print and
Save commands of an HTML document field is not supported if a document
is displayed in the field for which the web server host name is different from
the web client host name.
Cancel and Undo commands behavior in multiple line text boxes is different
from other clients. In the web client, the amount of canceled changes is defined
by the browser.
The result of left clicking a word in a text box (with pressed Ctrl) depends on
the browser and the clicked word is not selected.
Clicking left/right arrows in a text document field in the first/last string posi-
tion will move the pointer to the previous/next string.
In a multiple line text box and in a text document field, entering text in the
insert mode is not supported.
In a multiple line text box and a form table cell, text is broken only per word.
Solid text at element border is not wrapped.
When Shift+Del is pressed in a multiple line text box, the whole string
is deleted and automatic line break for text box borders is not considered.
If an invalid XML version 1.0 character (http://www.w3.org/TR/xml/) is program-
matically moved to a text box, in Google Chrome and Safari this character
is replaced with "?" and the text box becomes uneditable.
If a tip text contains line breaks, in Mozilla Firefox white spaces are shown
instead.
The web client language in Safari matches the browser interface language, if
the interface language is not explicitly set using the L command line option.
When the web client is debugged and local variables or method options are
used in the Expression window, a table or breakpoint conditions, their names
should be specified exactly as they were set in the definition (accounting case
characters).
Appendix 6. System Behavior in Various Modes 2-1227
The following features are not supported in the web client:
○○ General:
□□ Print using the current printer.
○○ Graphical schema field:
□□ Search and Replace.
○○ Spreadsheet Document:
□□ Go to Cell.
○○ Text Document:
□□ Go to Line.
□□ Using tabs.
□□ Text submenu of the main menu.
The web client does not support the following hotkey commands:
○○ Picture box:
□□ Zoom in (Num+).
□□ Zoom out (Num-).
□□ Picture scrolling using keyboard.
○○ Graphical schema field:
□□ Schema scrolling.
○○ Table linked to a hierarchical list:
□□ Minimize node (Ctrl + Num-).
□□ Minimize all nodes (Ctrl + Shift + Num-).
□□ Maximize node (Ctrl + Num+).
□□ Maximize all nodes (Ctrl + Shift+ Num+).
○○ Spreadsheet Document:
□□ Minimize group (Ctrl + Num-);
□□ Minimize all groups (Ctrl + Shift + Num-).
□□ Maximize group (Ctrl + Num+).
□□ Maximize all groups (Ctrl + Shift + Num+).
□□ scroll page left (Alt + PgUp).
□□ scroll page right (Alt + PgDn).
□□ Select cells using keyboard.
○○ Text Document:
□□ delete current line (Ctrl +L ): not supported in Mozilla Firefox, Google
Chrome, Safari.
○○ In MacOS X, when a non-English keyboard layout is enabled, hotkeys are
not supported if the following keys are pressed:
□□ Google Chrome: Alt and Alt + Shift;
□□ Safari: Alt, Alt + Shift, Cmd and Cmd + Shift.
2-1228 1C:Enterprise 8.3. Developer Guide
ColorChooseDialog object:
○○ Select()
StandardPeriodEditDialog object:
○○ Edit()
FormatStringWizard object:
○○ OpenModal()
DataCompositionDetailsProcess object:
○○ ChooseAction()
ScheduledJobScheduleDialog object:
○○ OpenModal()
ValueList object:
○○ CheckItems()
○○ ChooseItem()
ManagedForm object:
○○ ChooseFromMenu()
○○ ChooseFromList()
○○ OpenModal()
Changing a session option value referenced by at least one separator in the Inde-
pendent mode in 1C:Enterprise script leads to the following:
Object cache is cleared.
Reused values are deleted (see page 1-178).
When separator usage and separator values are changed in the session, it is recom-
mended to call the RefreshInterface() method.
Unique identifiers of data items associated with predefined data do not match for
data from different areas. In other words, if the Goods catalog has a predefined
item named P1 and two areas with codes 165 and 567, the unique identifier of
a data item associated with P1 in area 165 is not the same as the unique identifier
of a data item associated with P1 in area 567.
6.5.6. Users
When an infobase user is created (the InfoBaseUser object), you can specify
separator values for the user.
The DataSeparation property of the InfoBaseUser object is used for this
purpose. This property stores a structure with the following specifics:
The structure element key contains the name of the separator (as it is set in the
Designer).
The structure element value contains a string representation of the separator
value. For details about generating a string representation of a separator value,
see page 2-911.
2-1232 1C:Enterprise 8.3. Developer Guide
If a structure includes a record with a separator name, this separator value is set
for the user.
The DataSeparation property value determines:
Username uniqueness space, if the separator separates authentication (see page
2-900).
User list separation, if the separator separates users (see page 2-899).
Initial separator values setting of a user session for any separator defined in the
configuration (see page 2-910).
In this table:
1. An exception is raised when the receiver node list is automatically populated.
If an exchange plan includes at least one separator that does not include a meta-
data object with autoregistration enabled for this exchange plan, when the
database configuration is updated a warning is shown saying that the configu-
ration object is not included in the exchange plan separator.
2. When the receiver node list is automatically populated, a data area is used
which is defined by a set of separators, each of which separates both the
exchange plan and the metadata object. If not every separator that includes both
the exchange plan and the object for which changes are registered is used, these
Appendix 6. System Behavior in Various Modes 2-1233
object separator values are used for missing separators. If in the process of
change registration it is found that separator values are changed:
○○ For data area exchange plan nodes defined by the "old" combination of
separator values, data object deletion is registered.
○○ For data area exchange plan nodes defined by the "new" combination of
separator values, data object modification is registered.
Configuration modification is registered for all nodes and all exchange plans
regardless of their separation by any separator (only for exchange plans with
a checked Distributed infobase checkbox).
When scheduled jobs are received (by a unique ID or a scheduled job list), the filter
is implicitly set by separators according to the separator values set in the current
session. Based on a separator value, different scheduled job sets are available:
The Independent mode separator.
○○ The separator is used – only those scheduled jobs are available for which
separator values match current session separator values.
○○ The separator is not used – there are no available scheduled jobs.
The Independent and Shared mode separator:
○○ If the separator is used – only scheduled jobs with separator values
matching separator values in the current session are available.
○○ If the separator is not used – scheduled jobs with random separator values
and jobs with no separator are available.
If a scheduled job is marked in the Designer, when 1C:Enterprise is first enabled
with a new combination of separators, a list of scheduled jobs is created with the
current combination of separator values and separator usage. If a separator is not
used in this session and a scheduled job is included in this separator, the corre-
sponding scheduled job property will be set to the default value for the separator
type and separator usage will be enabled.
TIP
Creating separated scheduled jobs that are frequently executed with a large
number of data areas is not recommended. Rather, creating a non-separated
scheduled job that will process different separator values on its own is advised.
NOTE
In a file mode infobase a background job is running not with a set of separators
set in the session where the background job was started, but rather with a set
of separators of the session where the ProcessJobs() global context method
is executed (see page 2-831).
6.5.12. Constants
If all separators that include constants are used in a session, you can use constants
in the query language using the Constants table (similar to 1C:Enterprise 8.2.13
and earlier versions).
The ConstantValueManager object and the Constant table have fields corre-
sponding to splitters in the Independent and Shared mode.
6.5.13. Registers
An Independent and Shared mode separator acts in a register as a dimension that
logically precedes dimensions set by the application developer.
One recordset can only contain records with the same separator values set.
If the separator values in the record manager are set to values that do not match
current session values, the method execution returns an empty record;
If the values for separators that are not used in the current session are not set
in the record manager, the method execution returns an empty record.
When the Select(), Get(), GetFirst(), GetLast(), SlcieFirst() and
SliceLast() methods of the register manager are called, you should note the
following:
If the Filter property of these methods has a separator value passed as the
parameter for the separator used in the session, and this value should match the
separator value; otherwise an exception is raised.
When the Get() method is called, the Filter parameter should specify the
values of all the separators not used in the current session.
Recalculations
Recalculations are automatically included in the same set of separators as the
corresponding calculation registers. When recalculations are written, values of
separators set for the corresponding calculation register records are used.
If the Sequence Filling property of a document included in the sequence is set to
Fill automatically, sequence record common attribute values will be set to values
corresponding to the document generating this record.
For a deleted separator – the last name of the deleted separator appended with
white spaces before upper case letters (but not before the first upper case letter).
In this case upper case letters are converted to lower case letters (except for the
first letter in the separator name).
6.5.18.2. Filter
When the event log is generated (to view the log or export it using the Unload-
EventLog() method), filtering is always implemented for separators that are used
in the current session. This filter (forced filter) can't be disabled or changed. If
the event log is generated within the session where the separator is conditionally
disabled, the filter by this separator is also disabled.
For separators that are not used in the current session, filter values can be set by
the user. In this case the forced filter and user filter by separator values are added
with the AND operation.
When filter values for the User and Computer fields are received (using the
GetEventLogFilterValues() method), the result is generated as follows:
The separator is used – field values are returned from log records that were
registered for the current separation value.
The separator is not used – all field values registered by the event log are
returned.
When event log records are received programmatically (using the GetEvent-
LogFilterValues() method), a filter is generated by adding the
DataSessionSeparation element of the Structure-type to the filter struc-
ture. Every structure element contains a separator name as the key, and a set of
separator values that are used to filter event log records as the value. If the Data-
SessionSeparation structure contains multiple elements, a record will match the
filter, if it matches all values set in the structure (the AND filter).
This set can be specified using a structure (in this case the records are filtered by
one value) or using a structure array (in this case the filter is specified with a set
of values).
A structure used for a filter contains the following elements:
Using (Boolean type). Default value – True. Sets using a common attribute
separating data. If the value is set to False, the Value element is ignored and
can be omitted. Thus you can filter log records for which this common attribute
is not set.
Value (arbitrary type). Common attribute value, default value – Undefined.
If a structure array is specified in the SessionDataSeparation structure
element, an event log record will match this condition, if it matches at least one
value (the OR filter).
Consider the following example.
Appendix 6. System Behavior in Various Modes 2-1241
Example 1:
Type: Structure.
○○ Key: Subscriber, value: Structure.
□□ Item 1: key: Using, value: True.
□□ Item 2: key: Value, value: 1.
○○ Key: Branch, value: Structure:
□□ Item 1: key: Using, value: False.
In this case the event log records that simultaneously fulfill the following condi-
tions are filtered:
The Subscriber separator is used and set to 1.
The Branch separator is not used.
Example 2:
Type: Structure.
○○ Key: Subscriber, value: Array.
□□ Item 1: Structure.
Item 1: key: Using, value: True.
Item 2: key: Value, value: 1.
□□ Item 2: Structure.
Item 1: key: Using, value: True.
Item 2: key: Value, value: 5.
○○ Key: Branch, value: Structure:
□□ Item 1: key: Using, value: True.
□□ Item 2: key: Value, value: 8215.
In this case event log records that simultaneously fulfill the following conditions
are filtered:
The Subscriber separator is used and can accept values from 1 to 5.
The Branch separator is used and can accept 8215 value.
6.5.18.4. Other
If the user is not available in the current session (belongs to another data area,
is deleted, etc.), when you view the log, unload it and use the filter setting dialog
this user is shown as User name <not found>.
6.5.20. History
User actions history is stored in a slice of a unique combination of separator
values and user names. Different users with the same name are not distinctive. A
disabled separator represents a single value, for which history is also stored.
When an infobase is restructured (after the separator contents change) the
following actions are performed:
When a separator is added, it is considered that all action history previously
set in a database was written in a situation when a new separator is used and
its value is the default value of the added common attribute type.
History is cleared when a separator is deleted, so every unique value combina-
tion of the remaining separators never contains more than 200 history records.
2-1244 1C:Enterprise 8.3. Developer Guide
6.5.21. Queries
If an object is included in a separator and a data query uses the connection with
its object table, you can't use the object tabular section in the connection condition
(the UNTIL section).
Please note that performance of queries that are processed slowly (due to the large
number of connections) in a system without separators will be even lower if the
system contains over two separators or a separator of the String type. Therefore,
try to avoid using multiple connections in such systems.
Exclusive mode set for a data area prevents you from doing the following:
Creating new sessions for an area and its nested areas
Modifying area data from enveloping areas
Setting exclusive mode in enveloping areas
Please note that the restrictions described above mean that the entire infobase may
be seen as an enveloping area for any data area.
can take longer than in an infobase without data separation similar to the data area
in set separators.
TIP
Scheduled jobs used to update and merge the full-text search index should be
made non-separated.
Since the full-text search index is the same for the whole infobase (and not for
every separator combination), the IndexTrue method can return True, even if
there were no changes in the current session that can be included in the index.
Such changes can be applied in a session with other separator values.
The UpdateIndex(), ClearIndex(), SetFullTextMode() methods can be
used only when the session does not use any separator. Otherwise, an exception
is raised.
OPERATION
OF VARIOUS DBMS
○○ Current user has restricted access to data and query contains no ALLOWED
keyword.
○○ In other cases comparison of string data is not case-sensitive (String
values with different casing are treated as identical):
□□ when String type fields are compare explicitly.
□□ when GROUP BY statement is used.
□□ in ORDER BY statement with the exception of the above listed cases.
○○ The features listed above are relevant in the following cases:
□□ IBM DB2 9.1 is used.
□□ The compatibility mode for version 8.1 is enabled (the Compatibility
mode configuration property is set to Version 8.1);
□□ The database has been generated with 1C:Enterprise version 8.1.12 or
with later versions.
The background database configuration update is not supported when IBM
DB2 9.1 is used.
If you encounter one of the following situations:
○○ Long query execution time;
○○ A large number of drive operations during query execution;
○○ Presence of the HASH JOIN syntactic construction in the query plan;
○○ Significant speed improvement after current query optimization from 5 to 0,
○○ You are recommended to execute the following command: db2set DB2_
OVERRIDE_BPF=5000, and restart IBM DB2 DBMS. This recommendation
does not apply to DBMS version IBM DB2 9.7 FixPack 5 and later.
In the following example the square brackets, which can be in the Template
variable, have no special meaning.
SELECT * Catalog.Products WHERE Article LIKE Template+"%"
these two dates. The same applies to the DATEADD function regarding the
daylight savings time.
It is not recommended to use FULL OUTER JOIN in queries since this construct
does not function efficiently enough in DBMS. In most cases source query can
be re-written without using this statement.
You can't simultaneously use FULL OUTER JOIN and access tabular sections
in the selection field list.
In queries with the LIKE comparison operation, square brackets are considered
to be special characters only when they are used in the text literal, but not
in the expression.
In the example below the square brackets have a special meaning – they repre-
sent a set of characters:
SELECT * Catalog.Products WHERE Article LIKE "123[AB]%"
In the following example the square brackets, which can be in the Template
variable, have no special meaning.
SELECT * Catalog.Products WHERE Article LIKE Template+"%"
Appendix 8
This section explains the terms used to describe XBase object – 1C:Enterprise
script tool that helps operate databases.
The database compression method physically erases the database records that
are marked as deleted. The database clear method physically erases all database
records. After any of these methods has been used, deleted records cannot be
restored in future.
8.8. LIMITATIONS
The main purpose of XBase objects is organizing information export/import to/
from external files in DBF format.
XBase objects do not support memo-type fields. XBase objects support only exclu-
sive access to files. XBase objects support index files in CDX format. However,
it is not recommended to use index files created with XBase in external programs
(e.g., FoxBase) and it is not recommended to use index files created with external
programs in XBase objects due to possible incompatibility of versions.
2-1258 1C:Enterprise 8.3. Developer Guide
Appendix 9
SPECIFICS OF USING
SEPARATE MECHANISMS
Form
When program code in a waiting handler is executed, Ctrl + Break is not
processed and the screen is not refreshed. You also should not add program
code that will worsen user experience in a waiting handler.
The server is notified about form closing (and unlocking an object if
it is locked) in the following situations:
○○ The form is closed, if an object was locked in the form (for editing).
○○ Getting a form from a server using the OpenForm(), GetForm() methods.
○○ Calling server (context and out-of-context) form methods.
○○ Closing 20 forms.
○○ The system is in the waiting state for more than 20 seconds.
○○ When the following dynamic list commands are executed:
□□ deleting an item;
□□ marking an item for deletion;
2-1260 1C:Enterprise 8.3. Developer Guide
When managed form elements, the context menu and the automatic command
bar are accessed as named Elements property elements, you can use standard
CommandBar, ContextMenu and Form prefixes in both 1C:Enterprise script vari-
ants regardless of which variant was selected when the form was created.
TIP
If you need to manually generate form element names (e.g., when a form is cre-
ated programmatically), it is recommended to do this according to the same
rules used when the system does it automatically. But it is not recommended to
change form element names generated by the system when the form is designed
(e.g., when you are creating a form element by dragging an attribute).
When an element name is generated based on the path to linked data, the name
is generated as follows: the name is generated as the path to linked data with "."
characters excluded.
1. Elements linked with data (fields and tables) including elements linked to the
main form attribute. A name is generated based on the full path to the data.
If the linked data belong to the main attribute, the main attribute name is deleted
from the name.
Example:
The Products tabular section of the main attribute. Table name: Products.
Another object located in the AddObjectProducts attribute is edited
in the form. The table showing the Products tabular section of this object:
AddObjectProducts.
2-1262 1C:Enterprise 8.3. Developer Guide
2. Elements linked with data located in a table (columns) or linked to the current
table data. Except for the tables linked to the main attribute. The name
is generated according to the following rule: <TableElementName><PathToTa
bleAttributeData – PathToTableData>.
Example:
The Count attribute of the Products tabular section of the main form attribute:
ProductsCount.
The Count attribute of the Products tabular section of the attribute (not the
main attribute) AddObject: AddObjectProductsCount.
3. Elements linked with data located in a table (columns) or linked to the current
table data. For the tables linked to the main attribute. If a table directly shows
the main attribute, names are generated similar to how they are in point 1. If the
table is linked to an attribute of the main form attribute, names are generated
similar to how they are in point 2.
Example:
The List table linked to a dynamic list that is the main form attribute contains
a column showing the Date dynamic list attribute. Column name: ListDate.
A form contains a table linked to the object tabular section shown by a dynamic
list. The tabular section is named Products, and the tabular section attribute
is named Count. The table form element name: Products, and the name of
this form element: ProductsCount.
4. Predefined elements (context menus and automatic
command bars): <ParentElementName>ContextMenu and
<ParentElementName>CommandBar.
Example:
The form command bar: FormCommandBar.
The context menu of the Count column linked to the Products tabular section
of the main form attribute: ProductsCountContextMenu.
5. The name of the group linked to the element that is a command source:
<SourceElementName>Actions.
6. The name of a button located in the form (not in command bars or context
menus): <CommandName>. A prefix in the form of the element name is not
added for commands generated by an element.
Example:
The Write form command: Write.
The Change command of the Products tabular section: Change.
7. Name of a button located in the automatic command bar with the Autofill prop-
erty enabled: <CommandBarOwnerElementName><CommandName>.
Appendix 10. Automatic Form Element Name Generation Rules 2-1263
Example:
The Write form command: FormWrite.
8. The name of a button located in the automatic command bar with the Autofill
property enabled: <ContextMenuOwnerElementName>ContextMenu<Com-
mandName>. A prefix in the form of the element name is not added for
commands generated by an element.
Example:
The Pick context menu command of the Date field: DateContextMenuPick.
9. The name of a group located in the command bar or the context menu without
its own command source: <ParentElementCommandSourceName><Group
Name>. Group names do not affect child element names.
10. Name of the group located in a table linked to the main form attribute:
<FormTableName><GroupName>. Group names do not affect child element
names.
Example:
PriceAndCount in the Table table: ProductsPriceAndCount.
11. Names of buttons and groups located in non-automatic command bars with
a source: similar to point 7. Names of buttons and groups located in non-auto-
matic command bars without a source: names are not modified.
12. The name of a button group located in command bars or context menus
with a command source: <CommandBarParentElementName><Group
Name>. Every name is generated according to the rules stated above. Having
a command source does not affect name generation. For child elements they
become parent groups based on the rules stated above. The CommandBar prefix
is not added.
Example:
A button group with the Form data source is added in the ServicesCount column
context menu. The standard group name is ServicesCountContextMenuFor-
mActions.