List form in 1C enterprise. How to open a list form with some selection? So, what is selection and why is it

Selection settings and list form management in 1C 8.x

In the eighth version of 1C, more “harmonious” capabilities for working with dynamic lists appeared than in version 7.7.

Dynamic lists should be understood as forms of lists of directories, documents, and registers. All those objects that are shown on the screen as you scroll. List forms, as we know from the previous article, have standard command panels with a standard set of control buttons.

The selections include the following buttons:

And for more younger versions 8.x:

When opening any standard list form control panel, we can find standard selection control buttons on the panel. For 8.1 and 8.2 they are slightly different in appearance, but they are similar to “funnel” filters.

In addition to selection buttons, version 8.x introduced important function, which was so lacking in version 7.7: the ability to display, print or save to disk all the elements of the list in the form of a table. To do this, you no longer need to ask the programmer to draw a report.

So, what is selection and why is it?

Imagine a classic table:

It can have any number of rows and columns. In essence, a list of directory elements, or a list of documents, is the same table.

Often there is a need to select from a common heap and display several rows with the desired column values:

  • All products with the first characters in the article = 100
  • All documents from the required counterparty, etc.

Or vice versa, remove “interfering” elements from the list:

  • All goods are foreign goods
  • All goods with an empty VAT rate.

This is where selection tools come to the rescue. In 1C you may encounter selection in many different variations. But the principle will be the same everywhere: select rows with the required values ​​in one or more columns. Or remove lines with unnecessary values ​​in columns.

The main selection control button is the first one on the left

It opens the main selection form for the selected list form

An example of a form for selecting a directory of fixed assets

Each line of this form corresponds to a column of the tabular list form (Not all columns may be displayed on this form. Some columns cannot be used in the selection). The selection can be either one or several columns at the same time.

The line contains the name of the column with a mark, the type of comparison and the value for selection.

Values ​​for comparison can be various types. If column simple type(number, string, date), then you simply enter the value for comparison in the field (Code = 1000, Name = part). If column complex type(link to a directory element, document, enumeration), then in the selection value field you need to select an element of this type.

Type of comparison

In addition to the simple “column equals value,” more flexible types of comparison are often required.

Moreover, the types of these comparisons depend on the type of selection value. A date can be checked not only for equality, but also for compliance with a range (date from the beginning of the month to the end of the month), a number - for belonging to an interval (sum from 1000 to 1500). The line can be checked for occurrence (the comment contains “under the report”). In addition, directory elements can be checked for inclusion in a group, but not for more/less. You can also use selection by multiple values ​​- for example, we need rows containing columns with multiple values.

For any type of comparison “equal” there is a similar type of comparison “not equal”. This means that when this type of comparison is selected, the list will contain all rows except those whose columns contain the values ​​specified in the selection value. Full list types of comparison:

  • Equals (all data types)
  • More (dates, numbers, strings)
  • Greater than or equal to (dates, numbers, strings)
  • Less than (dates, numbers, strings)
  • Less than or equal to (dates, numbers, strings)
  • Interval (4 types s different types occurrences of boundary values) (dates, numbers, strings)
  • Contains (strings)
  • In the list (all types)
  • In group (reference types)
  • In a group from the list (reference types)

A number of the above types correspond to opposite meanings:

  • Not equal
  • Does not contain
  • Not on the list
  • Not in group
  • Not in a group from the list

At the beginning of each selection line there is a field in which you can check or uncheck. Checking this box means that the filter will be used even if you have not specified a value for the filter (it will be set to an empty value). And vice versa - turning off the mark means refusing to use selection. In this case, the selected value for selection and the type of comparison remain filled in.

As we remember, the command panel, in addition to the “main funnel”, also contains other selection control buttons. The second button in this list is selection by current value. This button is very convenient for practical use, which we will discuss later. Its action is as follows: set the selection by value in the current column. This saves some time and allows you to speed up many actions. The third button is selection history. When you click it, you see all the selections that you previously applied to the current list. The list is stored even after you finish working with the program. But only if you ended your work session correctly, and not by rebooting or turning off the computer. And finally, the last button disables all installed selections.

Customizing the appearance of lists, saving them and printing them.

All standard list forms have column and print control buttons. Column settings are called up from the “actions” menu by right-clicking on the list form. Sometimes this button is placed on the command panel.

Clicking it opens the configuration form:

Visible columns are marked with checkmarks. You can disable unnecessary ones and enable invisible columns. The right side for the current column shows the position and size controls. The width of all columns can usually be changed by placing the cursor in the table header on the border of the columns (when the cursor takes the form ). If it doesn't change the view, resizing is disabled in the column settings. You can enable resizing in the above setup form (select the column - Resize: Change).

When did you receive the right type list, you can print it or save it to disk.

We look for the “display list” button next to the list settings button. Click - a dialogue opens:

Here, visible columns that will be printed are also marked with checkmarks. We remove the unnecessary ones, enable the necessary ones and click OK. By default, the list is output to a spreadsheet document and this spreadsheet document will be immediately displayed on the screen. (although gourmets can output it to a text document, in it the columns are separated by tabs). At the same time, be careful with dynamic lists (these are those that are shown in screen portions and the number of their elements is not known in advance). If your product reference book consists of 100 thousand items, then you simply will not wait for the printing form to be created, or your computer will not have enough memory. You either need to know the approximate number of elements that your list reflects, or correctly set the selection. So that the list can be viewed with your eyes from beginning to end. In general, you should not print a list of more than 10,000 items.

So, the list is on your screen - now you can print it. It can also be saved to disk for transfer or later use. By default, it is saved in the internal 1C format in a file with the extension *. mxl. To do this, in the upper right corner, select the “File” menu item, then “Save”. The standard file saving dialog is called up. You can open such a file only in the 1C environment. Moreover, the same version of the platform. (“File” - Open - select your previously saved file).

Practical examples:

1. Let's print a list of invoices created by the user Ivanova

If we see a document created by Ivanova in the list, we simply stand on the cell containing “Ivanova” and click select by the current cell. We wait for some time and see a list of documents created by Ivanova. At the same time, we do not need all the documents, but only for two organizations (for example, private entrepreneur "Entrepreneur" and Trading House "Complex" from the demo database). We press the first main selection button, in the dialogue we find the line “organization”, select the type of comparison “In the list” (we need two organizations), in the value field we press the selection button and select it in the list 2 needed by the organization. Click OK and see what you wanted to see in the list. Click on display list. Leave only the columns Number, Date, Amount, Organization, counterparty and click withdraw. The list is ready. If we want to swap columns (“Sum” should be last), open the list setup form and “move” the desired column down or up using the sort arrows.

2. Let's remove from the list of goods in the receipt document all goods except the three needed.

Let's say we copied a document. And we need to leave only a few positions from the entire list. Almost every tabular part has a selection that can be called with the right mouse button.

Open the dialog, select “item” NOT in the list and then select the products that need to be left in the list. Click OK and see a list that consists of completely unnecessary products. Press and hold the “DEL” button until the list is completely cleared. Then right-click on the list and turn off the equipment. In the list we see only the necessary products.

How to open a list form with some selection?

There are several ways to open a list form with some pre-set selection. Let's look at them in order:

1. The first method is that when opening the form, you can set the form parameter Selection, and open the list form with this parameter. The Selection parameter represents the structure. The names of the elements correspond to the names of the fields by which the selection is made, and the values ​​contain the selection values. This is a dynamic list managed form extension option. That is, it exists for forms whose main attribute is the type attribute Dynamic List, such as list forms and selection forms.

When opening the form, selection will be made based on the specified field. For example, in the following example, a list of invoices is opened with selection by the Number field, equal to 333.

Selection Value = New Structure("Number", "333");

SelectionParameters = New Structure("Selection", SelectionValue);

OpenForm("Document. Receipt Invoice. List Form", Selection Options);

2. You can open a list form without parameters:

OpenForm("Document.Invoice.ListForm");

And then, in the event handler of the invoice list form When CreatedOnServer write code that creates a selection in a dynamic list, which is the main attribute of the form:

&OnServer

Procedure When CreatedOnServer(Failure, StandardProcessing)

Selection Element = List.Selection.Elements.Add(Type("DataComposition Selection Element"));

SelectionElement.LeftValue = NewDataCompositionField("Number");

SelectionElement.ComparisonView = DataCompositionComparisonView.More;

SelectionElement.Use = True;

SelectionElement.DisplayMode = ElementDisplayModeDataCompositionSettings.Inaccessible;

SelectionElement.RightValue = "000000001";

End of Procedure

The advantages of this method are that the Comparison Type for the selection can be set not only Equal, as in the first case, but also More, Less, etc.

But this method also has a very significant drawback: with this selection, the form will always open. Wherever she was called from. Therefore, this form should not be designated as the main one. And if, nevertheless, it is the main one, then before installing the selection, it is necessary to provide some kind of analysis of where this form opens from. For example, analyzing form parameters.

3. Finally, the selection condition can be placed in a custom query that selects data for a dynamic list. For example, we need to open a list of invoices that contain the item highlighted in the item list.

To do this, in the form of a list of items, create a command and a corresponding button Receipt invoices.

Let's fill out the execution handler for this command as follows:

&OnClient

Procedure ReceiptsInvoices (Command)

ListForm = GetForm("Document.Invoice.ListForm");

ListForm.FilterByProduct = Elements.List.CurrentRow;

ListForm.Open();

End of Procedure

In this handler, we receive the form for the list of invoices and pass the link to the current item in the item list to the FilterByProduct form parameter and open the form with this parameter.

Then we will create a document list form Invoice and create the FilterByProduct form attribute, which we will use as a form parameter when opening it. Now let's open the properties palette of the main attribute of the List form. Let's set the flag CustomRequest and in the line List setup click Open.

In the Request field, enter the following request text:

CHOOSE

Document Receipt Invoice. Number,

Document Receipt Invoice.Date

FROM

Document.ReceiptInvoice AS DocumentReceiptInvoice

WHERE

Document Receipt Invoice.Products.Product = &Product

In the request, we use the Item parameter, which will receive a link to the current line in the item list, contained in the FilterBy Item invoice list form parameter. To do this, in the OnOpen list form event handler, we will write code to set the value of the Product request parameter:

&OnClient

Opening Procedure (Failure)

List.Parameters.SetParameterValue("Product", FilterByProduct);

End of Procedure

Here List.Options is a list of dynamic list request parameters for the List attribute. The value of the Product parameter is set equal to the value of the FilterByProduct form parameter.

As a result, at the click of a button Receipt invoices in the form of a list of items, we will receive a list of only those invoices that contain the items highlighted in at the moment in the nomenclature list.

A demo example for the 3rd option is located in the 1CITS/EXE/FAQ/OpenFormWithSelection.dt directory. The example was performed on platform version 8.2.9.356.

Interface development in 1C consists of two parts - the development of a menu or desktop and the development of 1C screen forms. The windows with which the user works in 1C are called 1C screen forms or simply 1C forms.

Users in the program work with 1C forms. Moreover, users see only 1C forms. Therefore, from the point of view of ease of use in the program, this is one of the important elements. At the same time, you can waste more time developing a 1C form than programming the most complex algorithm.

A common mistake programmers make is trying to draw everything to their liking. Make the background blue and the text green. Or yellow on black. Or how he likes it in some other favorite program.

Unfortunately, this approach is wrong, since users are accustomed to working with standard 1C forms, which are the majority in the configuration. Drawing your own bicycle and marking it with Courier inscriptions like “Copyright Vasya Pupkin” is clearly in bad taste.

Now we will go through a short educational program on drawing 1C forms.

What are Forms 1C

Form 1C is a method of presentation to the user. Typically, a form consists of a series of fields that need to be filled in and a set of buttons (menu commands) to control. Most 1C objects have a 1C form.

The 1C thick client uses “regular” 1C forms. This means that the programmer simply draws a 1C form with the mouse, just as is done in Visual Studio and other frameworks.

The 1C thin client and the 1C web client use 1C managed forms. This means that their size, 1C shape and the location of the fields on them cannot be changed with the mouse. They are generated automatically based on the settings. We will talk about managed 1C forms in the following lessons.

Most forms of 1C standard configurations in 1C have their own standard presentation that is familiar to the user.

How 1C forms work

The logic (order) of user work in 1C is as follows:

Thus, the user always works with 1C forms, starting with the 1C list form and moving to the 1C element form. If the programmer has not drawn the forms, then 1C generates the forms by default. They are naturally deprived perfect beauty and perfection, but they allow you to work.

An automatically generated 1C list form usually contains a minimum of fields (code/name and date/number, respectively). The automatically generated element form usually contains all the fields (details) listed from top to bottom.

The task of the 1C form is to open and wait for user actions. When acting, react. Thus, the basis of the 1C form module is event handlers. These are functions that are called when the user performs some action on the 1C form.

Where are 1C forms located?

In 1C Enterprise mode, when you select almost any 1C object (directory, document, report, processing, etc.), the form of this object will open to you.

In the configurator, in the configuration window, select the object you need, expand its branch to see the 1C Form sub-branch.

Another option is to open the object editor (twice with the mouse or place the cursor and Enter) and go to the 1C Forms tab.

Here is a list of 1C forms. One of the added 1C forms can be added as the default form (1C list form, 1C element form, and so on).

Creation of 1C forms

To add a new 1C form, you need to click the Add button (Ins on the keyboard). To enter an existing one, double-click on it with the mouse.

The designer will prompt you to select the type of 1C form - 1C element form, list. Here you can add or remove command panels on the 1C form. Most often these settings are left as is, by default.

The 1C form opens, filled out by default - all the details of the 1C object that exist have been added to it. You can tick the specific list of required fields on the second tab of the designer.

Unnecessary details can be deleted. To do this, select one or more fields and press Del.

To move other details into the free space, select them in the same way and drag them with the mouse.

To add new details to the 1C form, click the button on the Data Placement panel (Form/Data Placement menu), check the boxes for the elements that need to be added, as well as the “Insert labels” and “Place automatically” checkboxes.

Alternatively, you can simply add a control by clicking the corresponding button on the panel below or selecting Form/Insert Control from the menu. Click on the control element (field) twice with the left mouse button and its properties will open. The “Data” property contains the name of the attribute. Here you can change or assign it.

The control's properties also contain checkboxes to control the appearance of the control. You can use checkboxes to enable or disable select, drop-down, clear, visibility, and accessibility buttons.

Almost all document forms use bookmarks. Adding a bookmark is the same as adding another control (see above), you just need to select the “Panel” control. To add a panel page, right-click on it and select Add Page. Other controls (fields) are simply dragged and dropped onto panel pages.

To change the size of the 1C form, simply move the cursor to the edge of the 1C form, click the left mouse button and simply drag the edge of the 1C form.

For Form 1C to work - i.e. did something in response to user actions - you need to add handler functions. Enter the properties of any element (by double-clicking on it with the left mouse button) or the 1C form itself (similarly on the form header). At the very bottom of the properties window there is a section called “Events”. Select a convenient event (for all fields this is usually “On Change”, for the form “On Opening”) and click the button with a magnifying glass. Its event handler will open.

For buttons, adding is the same. However, in addition to arbitrary handlers, you can choose one of the standard ones for this form (for the directory form these are some standard actions, for the document form - others). Just select one of the standard actions in the “Action” property or click the cross if you want to create your own handler.

In the last lesson we looked at it for a regular (fat) client. In platform version 1C 8.2. They use new screen forms 1C 8.2. They are called managed forms 1C 8.2.

Managed forms 1C 8.2 are the future of 1C. They differ from regular 1C 8.2 forms in that they are generated automatically by the system based on special settings (“regular” forms are simply drawn by the programmer at will).

The differences in the development of managed forms 1C 8.2 from conventional ones are significant. Therefore, we have gathered today to separately discuss the creation and modification of managed forms 1C 8.2.

Managed forms 1C 8.2

If you have been developing 1C configurations before, when you open the 1C 8.2 managed form editor, you will immediately be puzzled by the fact that it is impossible to influence the 1C 8.2 form at all with the mouse.

You cannot change the 1C 8.2 form, you cannot move an element, you cannot even view the field properties as before - by double-clicking the field on the 1C 8.2 form.

Now the basis for developing a 1C 8.2 form is not binding fields to coordinates on the form, but special settings. The system automatically generates a controlled form 1C 8.2 based on these settings.

The settings consist of a list of 1C 8.2 form elements located in the editor in the upper left corner. The elements of form 1C 8.2 include:

  • Details
  • Commands (a new concept in 1C 8.2, may look like buttons or menu items)
  • Groups (for combining details and commands).

Accordingly, the settings for these elements are not in the properties of the fields, but in the properties of these setting elements (right-click menu, Properties item).

How managed forms 1C 8.2 work

Working with managed forms 1C 8.2 is different for the user. They have more capabilities, but are unusual for those who have been working with 1C for a long time.

First of all, the arrangement of the usual elements on the 1C 8.2 form is different. The command bar is always at the top.

The left side of the command panel is customizable. It usually contains such standard buttons as Record and Post.

The right side of the command panel is the new standard menu of the 1C All Actions form. This menu allows you to manage the 1C 8.2 form as you wish, similar to how in the ACS report the settings allow you to significantly change the appearance of the report.

Arbitrary menu items 1C All actions

Depending on whether this 1C 8.1 form belongs to one or another, the menu is filled with items that allow you to manage this object. For example, if this is a directory list form, then there will be commands such as Create or Edit.

Item Customize menu list 1C All actions

If there is a list on the 1C 8.2 form, then the menu has the command Configure list and Display list.
If the Output list command is already familiar to you - it allows you to save any list in 1C in Excel / print it out, then the second command is new.

As you have already noticed, there are no selection buttons on the list command panel anymore. Instead, a Find button appeared, the operation of which (as well as the currently disabled positioning of the cursor in the list when typing) has some complaints.

The functionality of the Find button is of course not comparable to selections, but they haven’t gone away!
They are now located in the Customize List menu item. Selection can now be done by any field, and in addition to it, you can do sorting and conditional formatting in the same way as you can do in ACS reports.

Item Change menu shape 1C All actions

The Change form item allows you to similarly change not only the list on the 1C 8.2 form, but also the 1C 8.2 form itself.

The user can independently enable or disable the visibility of fields on the 1C 8.2 form, width and height, activation of the default field when opening, etc.

Using managed forms 1C 8.2 and regular forms 1C

By default, regular 1C forms are used in configurations for the thick (regular) 1C client, and managed forms are used in configurations for the thin and web clients of 1C. However, both 1C forms can be used in any configuration, including simultaneously.

To do this, you need to enter the configuration properties (the top element in the configuration window).

In the configuration properties in 1C 8.2, two new checkboxes have appeared that allow you to enable non-standard use of 1C forms.

Creating Managed Forms 8.2

Addition new form 1C 8.2 is produced in the same way as before - using the Ins button on the keyboard or the Add button. To enter an existing one, double-click on it with the mouse.

By default, the form (regular or managed) that is installed in the configuration will be created (see the Main launch mode property in the configuration properties. If you have enabled permission to use both types of forms in the configuration - in the form designer, which will immediately open - you can select the type forms.

The designer will prompt you to select the type of form - element form, list form. Here you can add or remove command panels on the form. Most often these settings are left as is, by default.

A form opens, filled out by default - all the details of the 1C object that exist have been added to it. You can tick the specific list of required fields on the second tab of the designer.

The form editor consists of three sections.

  • In the upper left corner there is a list of form elements. It consists of fields, commands and groups that allow you to combine elements. The list of commands can be viewed separately on the Command Interface tab.
  • In the upper right corner there is a list of available form details and object details (open the cross next to the Object attribute).
  • Below is a preview of the resulting form.

You can drag the available details to the left and it will become a form element (a field on the form).

If you need to add a button or menu item, on the right side of the Commands tab you need to create a new Command. This is a wrapper for a function in the form module. In addition to specifying which function will be called, you can assign a representation - for example, a picture, as well as the dependence of visibility on the functional option.

Commands are also dragged to the left. If the parent is the command bar, then it will be a command bar button - otherwise just a button.

You can not only drag and drop object/form attributes into the list of form elements (fields), but also simply add them (Add or Ins button). In particular, you can create a new form object – Group.

The group can be a command panel (the cursor must be on the Form line). Then you drag commands into it and they become buttons.

The group can be "regular". Then this is a way of grouping fields both vertically and horizontally. The group name can be removed in the properties.

A group can be a panel (page). The top added group is a panel, and the nested groups of this type are pages. Fields are already dragged onto the pages.

Unneeded form elements are removed by deleting the form elements in the list.
The position of the field on the form is determined by the order in the list of elements (vertical) or by using groups (horizontal). Width and height are set in the properties of the form element.

The form element properties have been significantly expanded and contain many useful things - both appearance control (select and clear buttons) and checking default values.

The properties of the form itself, including its dimensions, are set at the root element of the form with the same name Form.

Event handlers (responses to user actions) are now divided into two types. Old – as before, they are indicated in the properties of the form and fields (for example, OnChange and OnOpening the form). New ones have become commands and are used for menu items and buttons.

Forms in 1C:Enterprise are intended for displaying and editing information contained in the database. Forms can belong to specific configuration objects or exist separately from them and are used by the entire application solution.

For example, a directory Nomenclature may have several forms that will be used for specific purposes - editing a directory element, displaying a list, etc.:

Along with this, there may be general forms, not belonging to specific configuration objects - general forms.

Basic forms

Each configuration object can be used to perform some standard actions. For example, for any directory you may need to display a list of its elements, display individual elements of the directory, display a group of the directory, select elements and groups of elements from the directory. For any document, the list of such actions will be much smaller: viewing a list of documents, selecting from a list of documents, and viewing a separate document.

To ensure that such standard actions are performed with the data of application solution objects, for each of them there is a set of basic forms that will be used when performing the corresponding actions. Any of the forms subordinate to this object can be assigned as the main one. For example, in the directory Nomenclature The following basic forms may exist:

And the document Receipt of goods and services the composition of the main forms will be different:

Thus, if the user wants to view the directory list Nomenclature or list of documents Receipt of goods and services, the system will open the corresponding form designated as the list form for these objects.

Auto-generated forms

An important feature of the 1C:Enterprise 8 system is the mechanism of auto-generated forms. This mechanism frees the developer from having to create all possible forms for each configuration object. The developer just needs to add a new configuration object, and the system itself will generate the right moments The user's work requires the necessary forms to display the information contained in this object.

Thus, the developer needs to create his own forms of application solution objects only if they must have differences (different design or specific behavior) from the forms automatically generated by the system.

Linking a form to data

Whether a form belongs to a particular configuration object does not determine the composition of the data that is displayed in the form. The fact that the form belongs, for example, to a directory Nomenclature, allows you to assign it as one of the main forms for this directory, but does not in any way determine what data this form will display and what its behavior will be.

In order to associate a form with data, form details are used, which indicate the list of data displayed by the form. All forms, themselves, have the same behavior, regardless of what data they display. However, one of the form attributes can be designated as the main attribute for it (it is highlighted in bold), in which case the standard behavior of the form and its properties will be supplemented depending on what type the main form attribute is:

For example, if a document is assigned as the main form attribute Receipt of goods and services, then when closing the form, the system will request confirmation of recording and posting this document. If you assign, say, a directory as the main attribute of the form Nomenclature, then such a confirmation request will not appear when closing the form.

Form structure

The main feature of the forms is that they are not drawn by the developer in detail, “pixel by pixel”. A form in a configuration is a logical description of the form's composition. And the specific placement of elements is performed automatically by the system when the form is displayed.

The displayed part of the form (visible to the user) is described as a tree containing form elements.

Elements can be input fields, check boxes, radio buttons, buttons, etc. Additionally, an element can be a group that includes other elements. A group can be represented as a panel with a frame, a panel with pages (bookmarks), a page itself, or a command panel. In addition, the element can be a table, which also includes elements (columns). The element structure describes how the form will look.

All functionality of the form is described in the form of details and commands. Details are the data that the form works with, and commands are the actions to be performed. Thus, the developer in the form editor must include the necessary details and commands in the form, create form elements that display them and, if necessary, arrange elements into groups.

Based on this logical description, the system automatically generates appearance forms to display to the user. In this case, the system takes into account various properties of the displayed data (for example, type) in order to arrange the form elements as conveniently as possible for the user.

The developer can influence the arrangement of elements with various settings. It can determine the order of elements, indicate the desired width and height. However, this is only some additional information, which helps the system display the form.

In forms, the developer can use not only the commands of the form itself, but also global commands used in the command interface of the entire configuration. In addition, it is possible to create parameterizable commands that will open other forms taking into account the specific data of the current form. For example, this could be calling a report on balances at the warehouse that is currently selected in the invoice form.