1C:Enterprise 8.3. Developer Guide. Chapter 24. The Data Separation Mechanism

1C:Enterprise 8.3. Developer Guide. Contents


THE DATA SEPARATION MECHANISM

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 configuration.

„ 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.

Example:

//  Initially object is recorded with the value of the separator
//  Subscriber = 1
Object  = ObjectRef.GetObject();

//  Change separator value in the current session
SessionParameters.SubscriberValue  = 2;

//  Object will not be recorded and the exception will occur
Object.Write();

If recorded data contain separator values equal to default values of the corresponding 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.

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.

Fig. 323. Common attribute with separation

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).

24.2.               COMMON ATTRIBUTE PROPERTIES

24.2.1. Using Separated Data

The Usage of split data property determines the ability to use separated configuration objects data if the separator is not used in the 1C:Enterprise mode:

„ Independent – any access to separated objects is disabled (except exchange plans, for more details see page 1-405) if the separator is not used in the current infobase session. In this case the separator is not available in the object model, the query language, XML and XDTO export formats and data access restrictions. When separated data are written, the system automatically populates 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.

24.2.2. The Separator Value and Usage Flag

The Data split value property defines a session option that stores a separator value set in the current session. The session option type should exactly match the separator type.

The Data split usage property defines a session option (Boolean type) managing separator usage. If the value of the specified session option is set to True, it means that the separator is used in the current session (see fig. 324).

You can change session options in the process of system operation if the user on behalf of which the session is running has the rights to change the necessary session options. 1C:Enterprise does not guarantee application data integrity after session options change.

Changing a session option value referenced by at least one separator in 1C:Enterprise script leads to the following:

„ The object cache is cleared.

„ Reusable values are deleted (see page 1-178) both on the client side and server side.

Separator values can be specified in the 1C:Enterprise 8 startup command line using the Z option or in the connection string using the Zn option (see page 2-900).

Fig. 324. Session options and common attribute

24.2.3. Users Separation

The User split property determines which part of the user list will be available depending on whether this separator is used or not. If the property is set to Do not use, a single user list is used for all separator values. Users separation is used when the user list is accessed programmatically and in the Designer when you are editing the user list.

To determine whether a user is available in a session you can use the following table (related to a separator):

Separator is used in the session

Separator is not used in the session

The value is set for Available if separator values are equal the user

Available

The value is not set Not available for the user

Available

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 properties, if the user is authorized to change the corresponding session parameters.

24.2.4. Authentication Separation

The Authentication split property is used to manage the creation of users with the same name for different data areas. If the property is set to Do not use, the uniqueness of user names is tracked for all data areas. If the property is set to Split, users with the same names can be created in different data areas. For example, you can create multiple Administrator users who will differ only by their separator values (for separator values not set too).

If the Subscriber separator exists (the Number type) and its Authentication split property is set to Separate, you can create the following user list:

User name

Subscriber separator value

Administrator

Not set

Administrator

1634

Administrator

2245

Administrator

1245

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

24.2.5. Conditional Separation

24.2.5.1. Overview

Conditional separation is necessary when the application will be used both in separated and non-separated versions. For example, an application can be used for a stand-alone operation. In this case separators are not used, but they are provided in the application. But the application can also be used for a number of subscribers who are not related to each other (with an independent dataset in the infobase). Such behavior can be implemented using conditional separation: in case of standalone usage separation is disabled, but in the separated mode it is enabled.

Conditional separation works as follows:

„ For a separator (or an object included in the separator), you can set an object storing separator state for this separator.

„ By changing this object's value you can enable or disable separation with this separator for all objects (if conditional separation is set for the separator itself) or selected objects (if conditional separation is set for the object included in the separator).

„ 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 separation 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 separator 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 separation 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.

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 separator 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 conditional 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.

24.2.5.2. Conditional Separation Set in Common Attribute Properties

Using a Constant

A separator can be completely disabled using a constant. The constant should be of the Boolean type and should not be separated by the attribute (see fig. 325).

IMPORTANT!

At 1C:Enterprise initial startup (after conditional separation is added), the constant value will be False and separation will be disabled.

Let's review this case in more detail.

Fig. 325. Conditional separation using a constant

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

Conditional separation determined by the SeparationBySubscribers constant is used for the common attribute. If the constant is set to False, the separator does not work (separation is off); if the constant is set to True, the separator works (separation is on).

Thus, the following scenarios are possible:

„ The Subscriber separator value is 1, the separator is used and the SeparationBySubscribers constant value is True. In this session separation

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 SeparationBySubscribers constant value is False. In this session separation is conditionally disabled (for the Subscriber separator). In this scenario, regardless of the SubscriberUsage and SubscriberValue options values, the following items are available in the catalog:

Code

Name

Subscriber

1

Sandals

0

5

Slippers

0

Using Object Attributes

A more complex way of managing conditional separation is used if other separator data are used for conditional separation of a single separator. Then different behavior is possible within different data areas for a separator describing another data area.

Suppose that there is a set of configuration objects describing regulatory and reference information (RRI): Banks, Currencies, VAT tax rates catalogs. The following ability should be implemented:

„ different company groups can be accounted in an infobase;

„ every company group consists of organizations;

„ regulatory and reference information objects content can be common both for all company group organizations and individually for each organization.

The following configuration objects are required to implement this scheme:

„ The CompanyGroup catalog with the SingleRRI attribute of the Boolean type

„ The Organizations catalog

„ The Banks catalog

„ The Currencies catalog

„ The VATRates catalog

„ The CompanyGroup separator of CatalogReference.CompanyGroup type

„ The Organization separator of CatalogReference.Organizations type. This separator includes only objects describing RRI:

The Banks catalog

The Currencies catalog

The VATRates catalog

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.

Fig. 326. CompanyGroup separator contents

The Organization separator includes the Banks, Currencies and VATRates catalogs only. These catalogs are RRI and two usage options are needed for them:

„ for each organization of the selected company group

„ for all organizations of the selected company group

Fig. 327. Organization separator contents

The CompanyGroup catalog is not included in the Organization separator, since it is required by conditional separation rules (see page 2-900).

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 separator) 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

The Banks catalog will contain the following information:

Name

CompanyGroup

Organization

Alpha Bank

GL1

Empty reference

SberBank

GL1

ÎÐ1

VTB

GL1

ÎÐ2

Avangard

GL2

ÎÐ1

Uralsib

GL2

ÎÐ2

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 the Organization separator type is a catalog reference). So if the CompanyGroup separator is set to GL1, the Banks catalog list will display only one record: Alpha Bank.

Example 2

The SingleRRI attribute for the Progress item is set to True.

This means that separation is enabled for the Banks catalog. Thus, this catalog’s contents depend on both the CompanyGroup separator value and the Organization separator value.

Then for the Progress company group and AC World organizations, only VTB bank will be included in the bank list.

By changing the value of the SingleRRI (and separator values) when the system is operated, you can get this or that Banks catalog list (according to the conditional separation rules).

24.2.5.3. Conditional Separation Set for an object (the Content Property)

Conditional separation can be set for every configuration object included in a separator. In this case separation is disabled not for all objects included in a separator, but for objects for which conditional separation is configured.

Conditional separation can be controlled both by a constant and a configuration object attribute (see page 2-900).

Consider an example of this type of separation.

Suppose that multiple subscribers keep accounting in a single infobase and at the same time you can keep accounting on behalf of several partner organizations. One situation is possible when all partner organizations operate a single list of warehouses and another situation is possible when you can generate an individual list of warehouses for each organization.

The following configuration objects are required to implement this scheme:

„ The Organizations catalog

„ The Warehouses catalog

„ The Subscriber separator of the CatalogReference.Subscribers type

„ The Organization separator of the CatalogReference.Organizations type

We need to perform the following steps to implement this scheme:

„ The Organization catalog should be excluded from the Organization separator.

„ For the Warehouses catalog (included in the Organization separator), you need to set conditional separation using the SeparateWarehouseList attribute of the Subscribers catalog.

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 SeparateWarehouseList attribute will be set to False (Warehouses catalog separation is disabled in the Organization separator).

24.2.5.4. Specifics of Conditional Separation in a Distributed System

Using conditional separation in a distributed system has some specific points which you should know. These can be divided into "logical" and "technical".

"Technical" features include the inability to arbitrarily change the status of the object controlling conditional separation in a separated session, if this object is included in an exchange plan. It is related to the specifics of automatic object modification registration by separated exchange plans (see page 2-1232). If changes are made automatically, you can change the object controlling conditional separation either in a non-separated session or if the current object session is False, i.e., you can only enable conditional separation but you cannot disable it.

"Logical" features are related to the fact that changing the conditional separation state in the main node of a distributed infobase significantly affects the state and behavior of the whole distributed system. This modification can affect one data area if conditional separation is controlled by an object attribute acting as another separator type (see page 2-904 for an example of this). Changing a conditional separation state can affect the entire infobase if conditional separation is used to switch between two modes of an application (see page 2-902 for an example of this).

Thus, in the first case (the RRI example) when conditional separation is changed, regulatory and reference information in the peripheral infobase will be lost for users. So access for changing the attribute controlling conditional separation should be granted only to the data area administrator or a person with sufficient privileges to accept this type of changes.

The second example (switching the application mode) will affect the entire infobase. In peripheral bases, users can "lose" all their data (due to separator value change), etc. Obviously, only an infobase administrator can accept a change that critical (or a person entitled for such actions), as other users can't event read this attribute (or constant).

24.3. DETERMINING AN ABILITY TO PERFORM AN ACTION OR A DATASET

When multiple separators are used in the system, the following rule should be used to determine the availability of a certain action with this or that object:

„ For every separator that separates the required object, an ability to perform the necessary object is determined as there is only one separator in the system (of course, the separation mode is taken into account – independent or independent and joint).

„ Results for all separators are summed with the AND operation.

Further sections discuss the rules of execution of different actions with an object for one separator (if not explicitly stated otherwise). Then to obtain the final action, this rule should be applied if the object is part of multiple separators.

For example, the system has two independent separators: Subscriber and Organization. There are two catalogs: Nomenclature and Contractors. Every catalog is separated by both separators.

Example 1

You need to determine an ability to receive a list of nomenclatures, if the Subscriber separator is used and the Organization separator is not used.

Since both separators are independent, the separator should be used to receive the catalog's list. Thus:

„ You can get a nomenclature list for the Subscriber separator, since the separator is used. The result is True.

„ You can't get a nomenclature list for the Subscriber separator, since the separator is not used. The result is False.

„ Thus in a session with such separator settings it is impossible to see the catalog list (True AND False = False).

Example 2

You need to determine an ability to get a list of contractors, if both separators are used.

Since both separators are independent, the separator should be used to receive the catalog's list. Thus:

„ You can get a contractor list for the Subscriber separator, since the separator is used. The result is True.

„ You can get a contractor list for the Organization separator, since the separator is used. The result is True.

„ Thus, in a session with such separator settings it is impossible to see the catalog list (True AND True = True).

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 separators (the AND operation).

24.4. SETTING SEPARATOR VALUES ON STARTUP

When 1C:Enterprise starts up, there could be a need to specify separator values directly in the startup command line (e.g., to implement authentication, if authentication separation is selected).

If one or more separator values are not specified in the command line, missing separators are taken from the separators specified for the current user. If the same separator is specified both for the user and in the command line and their values do not match, the usage flag and separator value will be set from the command line, if the infobase user has the right to set session options storing the usage flag and separator value. Otherwise user authentication will not be implemented.

When a client run in the Designer is debugged, you can specify separators in the startup configuration dialog in the Designer (see page 2-1154). When specifying a user on behalf of which the system should start up, users are available for selection. The list of users is restricted by set separator values that separate authentication.

In the process of infobase user authentication, session parameters, which are referenced by the Usage of data split and Data split value properties of the Common attribute metadata object, are assigned values defined for the user. Before any 1C:Enterprise script code is executed (in the session module as well), session option values are set and when they are accessed the SessionParametersSetting event handler will not be called.

Note that the separator value is identified based on the passed identifier without considering usage of other separators, i.e., the separator value does not depend on the procedure of setting other separator values (and usage flag). If the system can't unambiguously determine the separator value based on its identifier (for example, there are two catalog items with the same code), an exception is raised.

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.

24.4.1. The Client Application Command Line

The Z command line option is used to set separator values.

Syntax:

-Z "[<Flag>][<Value>][,[<Flag>][<Value>]]"

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 specified 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 separator 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);

dd – day number (two digits);

hh – hour number (two digits); ii – minute number (two digits); ss – seconds (2 digits).

When specifying an option, you should set all date components, i.e., the option contains 14 digits.

„ For the String type, text is specified.

„ For reference types, a text representation of the Code or Number standard attribute. Codes and numbers should be unique for all values of the corresponding configuration object. 0 length code catalogs and documents with numerators can't be used.

If the "+" or "-" character should be in the beginning of an option value, the character is duplicated. If a text string describing a separator value should include the "," character, the character is duplicated.

If the value set in the command line option can simultaneously match values of different types (e.g., "1" can be True, "1" number, "1" catalog code and "1" document number), the conversion rule is defined based on the type of the corresponding separator.

If only a flag is included in the command line ("+" or "-"), but no value is specified, the default value of the corresponding type is used as the separator value.

Example:

-Z "-0,+001,+,---3"

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".

24.4.2. The Web Client or Thin Client Connected via a Web Server

You can specify separator values when starting a web client (or a thin client connected via a web server) using two methods: in the startup address (command) line using the Z option and in the default.vrd file.

24.4.2.1. Using the Z option

Separator values can be set in the address line using the Z option. The web client option format is similar to the client application startup command line.

Example:

http://localhost/infobase?Z="-FirstSeparator,+"

Characters which are invalid for the URL (RFC 1738, http://www.faqs.org/rfcs/rfc1738. html) are converted to UTF-8 and encoded according to section 2.2. URL Character Encoding Issues of the RFC 1738 standard (using % and two hex characters).

24.4.2.2. Using default.vrd

You can configure access to an infobase, so specific separator values will be set by infobase address and not by the Z command line option or an infobase connection string. To do this you need to configure the <zones> item of the default.vrd file accordingly.

You can also disable modification of objects related to the data separation mechanism if access to an infobase is enabled using a web client or a thin client connected via a web server (secure service). This method should be used when you need to guarantee that another data area will not be accessible when an infobase is accessed via the internet.

For more details on default.vrd file configuration settings, see the "1C:Enterpise 8.3. Administrator Guide".

24.4.3. External Connection and Connection Strings

The Zn option is used in a connection string and when an external connection is started. The option format is similar to the client application startup command line.

Example:

Srvr=localhost;Ref=Demo82Srv;Zn="-FirstSeparator,+,---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.

24.5. SAFE DATA SEPARATION MODE

When different scheduled operations performed within a session with unused separator values are used, the application solution code whose reliability is generally impossible to check can be executed. "Reliability" here means operating in strict compliance with defined restrictions without abusing them.

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

// "Go" to the required area
SetSeparatorValue(SeparatorValue);

// Set the safe data separation mode
SetDataSeparationSafeMode("Subscriber", True);

// Call the required program code
ProcessAreaData();

// Disable the safe data separation mode
SetDataSeparationSafeMode("Subscriber", False);

EndDo

You can check the status of the safe data separation mode by applying the DataSeparationSafeMode() method.

24.6. DATA AREA DELETION

Sometimes a data area may become unclaimed during system operation. This may be the case, for instance, when a subscriber stops using the service (when each subscriber works in one data area) or a group of companies is reorganized (when each company of the group works in its own area).

Sometimes separators are deleted from the system. But if a separator includes configuration objects with predefined data, it cannot be deleted until the predefined data is erased (see page 2-1230).

The data area is deleted by applying the EraseInfoBaseData() global context method or the /EraseData command string of Designer startup batch mode. In the 1C:Enterprise script method, the area to be deleted is defined by values of session parameters that define separator values in the session from which the method is called. The area defined by the separators used and by any value of separators that are not used will be deleted.

TIP

It is recommended that you change the values of the separators that define the data area right after the method is executed.

The user must have the Administration right and be able to get exclusive access to the infobase to call the method. The exclusive access right should be set via an explicit call of the SetExclusiveMode() global context method.

When the data area is deleted in Designer startup batch mode, the area to be deleted is defined by the /Z parameter of the startup command string (see page 2-910). Where not all separators are set, the area is defined in a way similar to calling the EraseInfoBaseData() method (see above). The system attempts to get exclusive access to the infobase. In the case of an error getting exclusive access, the execution of Designer startup batch mode fails with an error.

IMPORTANT!

If none of the separators is used in the session or data deletion is executed in an unseparated infobase, all infobase data will be deleted.

Data will be deleted from:

„ any tables connected with configuration objects that are part of separators (including predefined data).

„ settings storages.

„ user work history.

„ the list of infobase users.

„ Infobase time zone – if independent separators are not defined in the configuration, 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 compatibility 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.

24.7.            SPECIFICS OF SYSTEM OBJECTS BEHAVIOR

See the description of system objects behavior specifics on page 2-1229.

Leave a Reply

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

1C:Enterprise Developer's Community