1s 8.2 unload constants manually. Constants

Introduction to 1C Accounting

Constants in the 1C Accounting program are usually used to store information that either does not change at all or changes rarely. The simplest example is the name of an organization, which changes quite rarely. The convenience of using constants lies in the fact that information is entered into them once, which can then be used repeatedly when generating documents, reports, and when constructing reporting forms.

Constant list window

All work with constants is done in the window List of constants. If the end user has access to working with constants, then this window can be called by any menu item, button in the toolbar, or through the system menu Operations.

The list of constants can be selected by selecting the list Constants menu Operations main menu of the program. The constants list window is a table consisting of three columns. In the column Code enter a short name for the constants in the column Name a full explanation of the names of the constants is introduced and finally the graph Meaning contains the value of the constant itself.

Editing a Constant

When working with the 1C Accounting program, the user can edit constants only in the column Values for which you just need to enter the cursor into the desired cell and press the key Enter. Editing of other table columns is carried out only in the configurator.

Working with the history of a constant value

When setting up the task configuration, you can set the storage of the history of value changes for any constant. Such constants are called periodic. In this case, not only the latest values ​​of the constants will be stored, but also their previous values ​​with the dates of their entry. To view the history of a constant, you need to place the cursor on the line with the desired constant and press the key F5.

The constants history window is a table that indicates the date and the value of the constant as of that date. Records in the table are sorted by date. Changes in the table are entered automatically each time the value of a constant changes, and if there were several value changes during one date, only the last value is saved.

If necessary, enter a new line, press the key Ins after which you need to enter the date and constant value in the new cells. To cancel, press the key Esc.

So in 1C there are reference books. For example, a directory of goods (nomenclature). There we will indicate a list of goods that our organization sells.

With the help of such a directory, we can organize a price list for clients as well as a sales report for management.

Products are different. For example, products and chemistry. What should we do if the manager asks us to make a report - how much money did we earn from products, and how much from chemistry?

Easily! - we will answer. You need to add a directory of Types of Products, and add the following details in the Nomenclature directory. Now, when we introduce a new product, we will need to select the type of product.

However, the girls are not happy about this innovation - after all, now they need to fill out a whole additional field, and they already have a lot of work and do not have time to do anything. And in general! - they say - we have 900 types of products, and only 50 types of chemicals! Even a fool can see that the default product type should be products.

Great! – we will note. And... what to do?

Constants 1C

To edit constants, the default constants form opens. Each field on this form is one constant.

There are two ways to add a constant form:

  • Right-click on the 1C Constants branch and select the menu item Create constant form
  • Add a form to the General/General forms branch and in the wizard select the form type – Constant Form.

You can view (and select) the form of the constants as follows:

  • Enter the configuration properties (right-click on the top root branch of the configuration, which programmers usually call “Head”) and use the Basic form of constants property.

The constants form differs in that the main attribute of the form is of the “ConstantsSet” type. This allows you to write 1C constants not individually, but immediately as a set.

By the way, a form attribute becomes “primary” if it is specified in the Data property in the form properties.

In a program in the 1C language, you can access any constant easily and simply:

Value = Constants.NecessaryConstant.Get(); //read
Constants.NecessaryConstant.Set(Value); //write down

1C session parameters

So the problem is solved simply and with grace - we create a constant in which we will store the default type of product.

When creating a new product, the 1C language program in OnOpenForm() will set the value of the Product Type field to the one assigned in the constant. Voila!

Now the program works, but we won't stop there! Of course - we are cool programmers, we want the program not only to work, but also to work quickly!

Where are 1C constants stored? In the database, in a special table. Every time the operator creates a new product, he will break into the server and read the value of the 1C constant. What if there are 200 operators? Is this optimal?

What to do then?

And here we remember about the 1C session parameters. These are values ​​like constants that are filled in at the moment 1C starts in Enterprise mode and are immediately available on the client. In other words, this is a kind of cache on the client side.

In addition, if in a constant we can store a list only in a value store, then we can already unpack it into a 1C session parameter, although it will not be dynamic - it will be of the FixedArray type.

1C session parameters are also in the configuration window, located in the General/1C Session Parameters branch.

It is not enough to add a 1C session parameter, because if it is not filled in, the program will show an error.

Filling in (setting) the 1C session parameters should be done when starting 1C in Enterprise mode. Right-click on the top branch of the configuration (programmers call it “Head”) and select the menu item Open session module.

The module may already have a function SettingSessionParameters(). If there is not one yet, then select this event in the corresponding drop-down list. Here is an example of setting the value of a 1C session parameter:

SessionParameters.RequiredParameter = Value; //record, once at the very beginning
Value = SessionParameters.RequiredParameter; //reading, strictly after writing.

Purpose and use of constants in the 1C: Accounting system

Constants in the 1C: Accounting program are used to store constant or rarely changing information. The information contained in a constant can be changed. Having saved information in a constant once, you can then use it many times when generating documents, in calculations, and when generating reports.

Almost every report generated in the 1C: Accounting program contains such constants as Name of the enterprise, Manager, Chief accountant. By using constants, you save yourself from the painstaking work of editing report forms after, say, a change of manager or a change in the name of the organization. It will be enough to make changes to the specified constants, and all changes will automatically be reflected in the places where these constants are used.

Ш Select the menu command Operations ¦ Constants. The List of Constants window will appear on the screen in the form of a table with three columns: Code, Name, Value.

Ш Find the required constant, for example, Name of organization.

Ш Go to the Value column and change the organization name, if necessary.

A typical program configuration contains the necessary set of constants. The user only needs to enter “his” data into the values ​​of these constants. Inattention when filling in the values ​​of constants can result in errors in documents, calculations, and reports. Therefore, be careful and careful - the program does not tolerate negligence.

Periodic constants and their applications

The very name “constant” implies the constancy of the values ​​stored in them. However, sometimes the information contained in a constant needs to be adjusted. Of course, it is not difficult to make changes to the corresponding constants. But what if you need to get some document or report for the period when this constant had the “old” value. For such cases, in the 1C: Accounting program, some constants can store the history of their changes. Such constants are called periodic. Unlike ordinary constants, the 1C: Accounting program stores the values ​​of a periodic constant according to the dates of its change. When accessing the value of a periodic constant on a certain date, its value is returned for that date, or, if such a value is missing, for the nearest previous date.

Periodic constants are, for example, such constants as: Manager, Ch. accountant, cashier.

In the 1C: Accounting program, for a periodic constant, you can open the History window, reflecting changes in the value of the constant by date. To do this you need to do the following:

Ш In the Constant List window, select a periodic constant, for example, Leader.

Ш Click the button (History) in the List of Constants window. The History window will appear on the screen (Fig. 9).

Rice. 9.

The History window is a table consisting of two columns: Date of change of the constant value and Value as of this date. The History window allows you to edit the history of changes to a constant value directly: enter new lines, edit or delete existing ones.

Constants 1C 8.3 is a metadata object that stores information that rarely changes.

As a rule, constants store information about system settings. For example: regulated accounting currency, system header, values ​​for, etc.

Let's analyze the main properties, settings and features of the technical implementation of constants in 1C at the DBMS level.

Properties and setting of constants in 1C

The object manager has two main functions in the program code:

  • Constants.<Название константы>.Get();— getting the current value of the constant;
  • Constants.<Название константы>.Install(<Значение>); — setting a new constant value.

Get 267 video lessons on 1C for free:

Let's look at the main properties of the properties palette of a metadata object - constant:

  • Type— the type of a constant is not limited by anything.
  • Value manager module— a constant module that describes the following handlers: ProcessingFillCheck, BeforeWrite, OnWrite.
  • Data Lock Control Mode— controlled or automatic mode.
  • Use standard commands— a flag responsible for using the standard command display on the configuration interface. Often this flag can be the answer to the question - Why is the constant not displayed in the interface?
  • Basic form— a form from the list that is set as the main one for editing the value of a constant.

Video on creating and using constants:

Features of the implementation of constants at the DBMS and 1C level

Features can be divided into two types according to versions of the 1C platform:

  • before release 8.2.14— all constants in the system were stored in one table. Changing one record locks the entire table. You need to be very careful when using this metadata object;
  • after release 8.2.14— for each constant we made our own table. The parallelism of work has increased.

If you are starting to learn 1C programming, we recommend our free course (don’t forget

Constants 1c Enterprise 8.2

Let's look at what they are needed for constants in 1s 8.2. First of all, constants are data that always remain the same and have the same meaning, regardless of time. One constant can store one value. This may be the name of the company, the full name of the chief accountant, or the currency of financial settlements. To create a constant, you need to go to the 1c configurator, find the “Constants” object in the configuration and, double-clicking with the right mouse button, select “Add”.

Next, we need to specify two main parameters for the constants: name and data type. Let's create a 1c constant “Organization name” as an example. Now you need to select the desired data type. In our case, this is a “string”. The picture below shows a list of other data types for constants 1s Enterprise 8.2.


How to create a form for 1C constants?

To allow users to change the values ​​of constants themselves without the help of programmers, you need to create a form for the constant. This can be done by right-clicking on the Constants configuration object.


After this we will see the following.


By clicking on the “Finish” button, the appearance of all our constants will open in front of us. In this case, there is only one constant 1c and a field where we can write the name of our organization.

So, constants in 1s store important values ​​that do not change over time. They can be created through the configurator, and the data in them is written using forms for constants.