Home / Internet / 1s 8 creation from a dynamic list. Dynamic list settings

1s 8 creation from a dynamic list. Dynamic list settings

Finally, the dream of any "seven-player" has come true. How often users of program 7.7 asked to make a normal selection of items. So that you can see the balances, prices, and set filters. I had to come up with various tricks, up to writing external components. In 1C 8.2, dynamic lists appeared. I propose to consider what it is and what they can give us in 1C 8.3.

Let's take as a basis some test configuration 1C: "Enterprise accounting 3.0". We will not make a selection now, just add another selection form in the "Nomenclature" reference book and make it temporarily the main one:

When created, the system will by default add a table field with the "Dynamic list" type to the form.

Let's go to its properties and see what's there.

First of all, we are interested in the "Arbitrary request" checkbox. He will reveal to us all the advantages dynamic list. We will have the opportunity to write our own query, and with parameters. Check the box and click the "Open" link:

A window will open with a ready-made code for . So far, all the fields of the "Nomenclature" directory are simply listed there.

Get 267 1C video lessons for free:

As you can see, there is a call button "" and a checkbox that allows you to dynamically change the contents of the list. That is, when another user changes something in the directory, it will also change in our list. In addition, there is a Settings tab, but we will touch on that later.

Custom query in dynamic list

First, let's create the query we need with balances and prices. More or less like this:

Settings tab

And now the most delicious! Go to the "Settings" tab. And we immediately see that on the first tab we can make any selections for any field in the request:

Programmatically setting query parameters in a dynamic list 1C 8.3

Do not forget that we have two parameters in the request: "Period" and "Price type". We must pass them to the request, otherwise there will be an error.

Let's write these parameters in the form parameters, and add the following lines in the form module:

&OnServerProcedure OnCreateOnServer(Failure, StandardProcessing) List. Options. SetParameterValue("Period", Parameters. Date) ; List. Options. SetParameterValue("PriceType" , Parameters.PriceType) ; EndProcedure

In addition to primitive data types that can be found in any programming language, there are unique types in 1C. Each of them has its own properties, methods, functions, purpose and nuances of use in the system. One of these types is a dynamic list, which greatly simplifies many applied tasks. That is why developers should know and be able to handle this versatile tool.

Features of dynamic lists in 1C

The purpose of this type is to display information from any database tables, regardless of its type. The mechanism was created on the basis of the SKD and has similar capabilities. But this does not mean that you will definitely have to write a query in the 1C language, although this possibility exists and you need to use it. You can simply specify the table, the information from which you are interested in, and 1C will independently generate a simple query.

To see how a dynamic list is formed and what data it shows, you need to open managed forms, where it is located, in the configurator: in the list of details via context menu open its properties and pay attention to the item "Arbitrary Request". If there is no checkbox, then the "Main table" parameter reflects the database table where the data is taken from. Otherwise, the dynamic list reflects custom query data, which can be seen by opening the list setup.

An arbitrary query schema is much more commonly used, as it provides a great opportunity to combine and display a wide variety of data. Most often, this mechanism is used to reflect stock balances, item prices, income, expenses, or purchases. You need to use it carefully, as the performance may drop with complex queries.

Another useful property of the dynamic list is opened by clicking on the inscription "List settings". This menu allows, even when using a standard set of fields, to make information more accessible and understandable to end users. Whether it's an arbitrary request or not, you'll see a "Settings" tab where you can specify:

  • Selection of a dynamic list;
  • groupings;
  • sorting;
  • Decor.

The use of parameters makes dynamic lists versatile and flexible enough. You can also bind them to props on a managed form, and the data will change depending on the options selected by the user. The use of these mechanisms can be understood and appreciated by looking at examples of real-world problems.

As an example, consider the problem of reflecting the remnants of the nomenclature on a managed form. In real practice, such orders are quite common in various configurations, and the dynamic list is ideal as a tool. For this task, we will have to use an arbitrary query, dynamic list parameters and its settings.

For greater clarity, we will create a separate external processing and place a dynamic list on it. To implement our plans, there will be few tables with nomenclature, so we need to allow an arbitrary request. In it, we will describe the left connection of the reference book with the list of nomenclature and register of residues and set the reference book as the main table. Such a scheme will allow users, while working with a dynamic list, to add or change the nomenclature.



Choose a nomenclature. Name. Name as a name, goods and sales costlars. Sklad as a warehouse, goods and sales costlars. Clothing as a number of installations from a directory. Nomenclature as a nomenclature of the left connection of the register. Continuity. The installations (& runs,) as a goods and consumptions.

Since the CurrentDate parameter was used in our request, we need to set its value before using the processing. To do this, in the form module in the procedure "On CreationOnServer" by a standard command, assign the function "CurrentSessionDate" to it with a standard command. We also need to display a dynamic list on the control form and change the order of the fields for clarity. Drag the props "Nomenclature Remains" into the form elements (upper left) and use the blue arrows to change the order of the fields in the table on the form.

&At Server Procedure On CreationAt Server(Failure, StandardProcessing) Nomenclature Remains.Parameters.SetParameterValue("CurrentDate",CurrentSessionDate()) EndProcedure


Already at this stage, we can open our external processing in 1C and see that the dynamic list is working. We can look at the balances, create nomenclature and groups, and search. Often customers ask to add the ability to choose the date for which they will see the balance. In the case of a form with a dynamic list, this is provided by an additional field and setting parameters using it.

We add the attribute “Remains Date” of the “Date” type and transfer it to the form elements. In the field events, we create an event "OnChange" and write the code for setting the "CurrentDate" parameter used in the dynamic query. So that when opening the form, the user immediately understands on what date he sees the balances, we will make small changes to the OnCreateOnServer procedure.



&OnServerProcedureOnCreateOnServer(Failure, StandardProcessing)RemainsDate = CurrentSessionDate(); Item Remains.Parameters.SetParameterValue("CurrentDate", RemainsDate); End of Procedure &At the Client Procedure RemainsDateOnChange(Element) Item Remains.Parameters.SetParameterValue("CurrentDate",RemainsDate); EndProcedure

As a result, our Dynamic List form can display balances for any date.

We have covered only a small part of the capabilities of this toolkit, but this is already enough to understand the convenience of this type of dynamic list. A similar mechanism is used for many tasks, but most often it is found in typical configurations in managed forms:

  1. selection;
  2. Lists.

To get a dynamic list and its request in typical managed forms, the developer needs to open the required form in the configurator. In the attributes section, find the attribute with the data type "DynamicList" (most often it is selected in bold). Its properties contain the text of the request, selections and other settings.

home Notes from Looking Glass

04/21/2014 Getting dynamic list data

Implemented in version 8.3.6.1977.

We have implemented the ability to easily and conveniently obtain data displayed using a dynamic list.

You may need the dynamic list data in order to print it in a non-standard, "specific" form. Or in order to perform certain actions with them. For example, send a letter to all counterparties that you have selected in the list according to some criteria.

In addition, there are a number of tasks in which the user, in addition to the list of elements, also wants to see the summary data associated with this list. For example, having selected the goods of a certain product group and a certain supplier, he immediately wants to see the total number of such goods in the database.

The dynamic list itself cannot provide you with this information. The purpose of a dynamic list is to provide a quick view of large amounts of data. Therefore, it reads the data in chunks required to display on one or two screens. And “knows nothing”, for example, about the total amount of data that he has to read.

In general, in order to get the additional information that the user wants, you need to query the database. Exactly the same as the one used in the dynamic list.

You could do it before. But it wasn't always easy. After all, in addition to the text of the original query, according to which the dynamic list works, you needed to know all the selections, sortings, and other parameters that the user interactively set in the table that displays the data.

Now this task is easily solved. The dynamic list table has two new methods:

  • GetExecutableDataCompositionSchema();
  • GetExecutableDataCompositionSettings().

Thus, you get the data composition scheme itself, and, most importantly, all its settings, thanks to which the user sees the list exactly as it is. All you have to do is programmatically compose the layout and output it to a collection of values ​​(for programmatic processing) or a spreadsheet document (for display):

As a result, you will get a structure (or report) containing columns and rows that are displayed in a dynamic list table.

The important point is that the layout and settings that you get from the dynamic list table take into account, among other things, the visibility of the columns and the search applied. Since the settings are obtained separately, you can change the composition of the fields for your own purposes and get, for example, all the columns of the list, and not just those that are visible to the user.

When outputting to a spreadsheet document, there is another nice moment. In general, the appearance of the report will correspond to appearance dynamic list tables at the time the schema and settings are received. Including the conditional design of the table. You will need some additional actions only if you want to transfer the conditional design of the form to the report as well.

In the process of finalizing configurations, each 1C programmer encounters dynamic lists.
A dynamic list is an interface object used to display various lists of database objects or non-object data - register entries.
For example, a dynamic list is used to display a list of items:

To demonstrate the possibilities of a dynamic list, let's create an external processing, add the main form. Let's add a new attribute with the "Dynamic List" type to the form. Let's go to its properties and see what's there.
We are interested in the "Custom request" property. Enabling it will show us all the possibilities of a dynamic list. We will be able to write a query using almost all the features of the query language of the 1C: Enterprise system. Check the box and click the "Open" link:

By default, our list will display a list of items with a total balance for all warehouses. To implement such a list, add the following query:


As the main table, we will select "Directory. Nomenclature", this will allow us to work with the dynamic list, as with the list of nomenclature - add, change, mark for deletion elements of the directory. Similarly, setting the main table does affordable opportunity dynamic data reading - this means that the sample will be made in portions, as needed.
Next, we need to create form elements for our list:

If we try to run our processing in this form, we will get an error:


To eliminate it, you must set the value of the "Period" parameter. To do this, you can use the "SetParameterValue" method of the "Parameters" collection of the dynamic list. The method takes two parameters:
. "Parameter" - Type: String; DataCompositionParameter. The name of the parameter or data composition parameter whose value is to be set;
. "Value" - Type: Arbitrary. The value to be set.
Can be called in the "OnCreateOnServer" handler of the form:

Do you have a question, do you need the help of a consultant?


Let's give the user the ability to change the period for receiving balances. To do this, let's add the attribute and the "Date" form element associated with it:


In the "OnChange" handler of the "Date" form element, call the "SetParameterValue" method, passing the value of the associated attribute as the value. Similarly, we will change the procedure "On CreationAtServer" of the form. Since the method is available on the client, there is no need to call the server:


Now, when the date changes, the balances will be automatically updated:




Suppose users want to see either current balances or projected receipts. Let's consider one of the implementation options. Let's add a Boolean form attribute and an associated radio button:


When changing the value of the switch, we will change the text of the request. To do this, we will use the event handler "OnChange" of the form element "DisplayQuantityToReceipt". We need to change the "QueryText" property of the dynamic list depending on the value of the attribute. Since this property is not available on the client, a call to the server procedure is required:


The result of the changes made: