1C UV open the selection form. How to open a list form with some selection? How to open the form of a new object

Selection on managed forms in 1C 8.3

The article will consider the options for installing the selection in managed forms 1C 8.3. The selection for the dynamic list can be set statically or dynamically in the user interface or configurator. All selection options we will consider below.

  • Setting the selection in the configurator

Setting the selection in user mode

The dynamic list in contrast to the table or tree of values \u200b\u200bis a more appropriate solution for implementing forms of containing any lists, because The dynamic list provides the most wide range of tools for working with the selection, grouping of fields, sorting. This selection can be installed when working in a user mode or configurator, the principle is the same.

To set the selection in the enterprise mode, you must call the "Configure List" command.

Window opens.


The "Selection tab" contains a list of fields that are in the current list. Select the list fields for which we will filter. You can do this double click or using Drag and Drop.


We specify the type of comparison and value, click "complete editing", the selection is set.


When installing the selection in the enterprise mode on the list form, the fields of so-called fast selections are automatically created.


In order for the 1C platform automatically created the rapid selection fields, when developing a form in the configurator, you must specify a group of custom settings.


This selection will be saved only for the current user, which allows you to flexibly make customized dynamic list settings. However, if the task is to make a fixed selection for a specific list for all users of the system, we can solve it only through the configurator.

Setting the selection in the configurator

Working in the configurator, we can set the selection of a dynamic list of two species - fixed and dynamic. Fixed selection is configured once, dynamic or software - can be installed depending on any data in the system.

The principle of installing fixed selection in the configurator does not differ from the installation in the user mode described above. To set the selection, we must open the dynamic list settings.


Window opens.


Selection is asked the same as in user mode.

The Option "Enable in Custom Settings" determines whether the selection installed in the configurator is accessible in the user mode through the menu item "Configure List".


Dynamic (software) selection

Often there is a need to set the selection programmatically, for example, when opening a selection form, when we need to open a controlled form with the selection. The form pass parameter and the selection is set to this parameter. A frequent example of this is the selection of the elements of the directory by the owner.

Methods

If the configuration is present in the configuration, the BSP subsystem "Basic Functionality" is present, the software selection in the dynamic list can be installed using a typical method:

OutstandingClinerWerver. Establishing elementotor creativity ()

Signature of this method:

Dynamic list Type: Dynamic List - list in which you want to set the selection.

NamePole Type: Row - field for which you want to set the selection.

Running Type: Arbitrary - Selection (Optional. The default value: undefined. Attention! If you are able to convey indefinitely, the value will not be changed).

Victims Type: Vocational CommunicationComponation - Selection Conditions.

Representation Type: Line - Data Layout Element (Optional. The default value: Undefined. If it is indicated, only the use flag with the specified view is displayed (the value is not output). To clean, so that the value is displayed again, you should pass an empty string).

Using Type: Booleo - Use this selection checkbox (Optional. Default value: Uncertain).

Modatography Type: Model Management TelecommunicationCompletes - Method Displays this selection to the user. Possible values:

  • Model showing elementNewsCompones. Fast-access - in the group of fast settings above the list.
  • Model showing electro-setkomponovkyda. Live - to setting the list (in the submenu still).
  • Model showing elementNewsComponovkydata. Extafeated - to prohibit the user to change this selection.

Identifier services Type: String - Unique identifier for this selection (Used to communicate with user settings).

To remove some selection value, you must use the Type method:

OutstandingClinerver. DeleteElementsGroupsTootableDannamic position ()

Signature of this method:

Dynamic list Type: Dynamic Scripts - Props forms for which you want to set the selection.

NamePole Type: Row - the name of the layout field (not used for groups).

Representation Type: String - layout field view.

In the event of the absence in the BSP system, the selection can be installed on its own using the Poland object.

Elementotor \u003d list. Options. Elements. Addly (type ("elementotorbone-block")); Elementotor.levativeness \u003d new half-pink ("FULL NAME"); Elementatub. Environmentalization \u003d vocational assemblyCompon. Elementatub. Himmability \u003d Telecommunication ComplexComotive modes. Estimate access; // Optional elementator. The definition \u003d "Ivanov";

This selection will select the lines in which the value "FULL NAME" \u003d "Ivanov".

For the use of logical "and", "or", "not" is intended for the type of group-elementboratory data

Accounting \u003d list. Options. Electronts. Addly (type ("groupalemotabcompare")); Groupotherapy.TypeGroups \u003d TiberoupElementSeboLeblomBolds. Group. Elementotor \u003d groupotabbing. Elements. Addly (type ("elementotorbone-type")); Elementotor.levativeness \u003d new half-pink ("FULL NAME"); Elementatub. Environmentalization \u003d vocational assemblyCompon. Elementatub. The definement \u003d "Ivanov"; Elementotor \u003d groupotabbing. Elements. Addly (type ("elementotorbone-type")); Elementotor.levativeness \u003d new half-pink ("FULL NAME"); Elementatub. Environmentalization \u003d vocational assemblyCompon. Elementatub. The definement \u003d "Petrov";

This selection will select the lines in which the value "FULL NAME" \u003d "Ivanov" or "Petrov".

The selection in the dynamic list can also be used via a change in the text of the dynamic list request. This option is running when the dynamic list is made through a "arbitrary request".


To do this, add the condition "where the truth" to the query text ...


As can be seen, this approach is more compact from the point of view of writing code. The more complicated the selection conditions in the table part, we want to establish, the more bulky there will be an option using the selection through elementotorbone-free. However, the example with a change in the text of the query has its drawbacks - this implementation is not resistant to changes in code. For example, you made this implementation and forgot, but if in the future you want to modify the query text by adding any operator to it after where (arrange, grouped), you need to not forget about the fact that there are in the program code:

List. The setproof \u003d list. Butterproof + "and directover. FIO in (" "Ivanov" "," Petrov ")";

If this is not to take into account the error, but to avoid this, you can remake another implementation. In the Tex request, add such a condition:

Where (not & selected or the directory users in (& permitted))

List. Parameters. Setting the recognition ofparameter ("selected", FULL NAMES ()\u003e 0); List. Parameters. Installingparameter ("Allowed", FULL NAME);

Here the name is an array.

Ka is seen, 2 lines of code versus 10. Which method to choose depends on a specific applied task.

This code allows you to open a list of documents with the set selection, you can also open a list of reference items with the desired selection.

Code 1C V 8.2 UP Form \u003d open form ("Document. Source. Form. Formscribe"); // Open form
Folder \u003d Form. Learn. Title.Elements. Addly (type ("elementotorbone-block")); // add selection
Decabloser. Width \u003d Victims CommunicationCompon. // How to compare
Selection holder. Using \u003d truth; // Install the tank using the Poland) ("Nomenclature")
Selector. Alexification \u003d New Poland-shaped ("counterpart"); // According to which details we will make selection
Selection holder. The definition \u003d object. Kontragent; // and the selection value

In order to open the list form with a predetermined selection Use the following ways:

First method It is that when opening a form, you can set the form parameter, and open the list form with this parameter.

The selection parameter is a structure. The names of the elements correspond to the names of the fields for which the selection is made, and the values \u200b\u200bcontain the selection values. This is the parameter extension of the managed form of the dynamic list. That is, it exists in forms, the main details of which is the props of the type of dynamic list, for example, the forms of the list and forms of choice.

For example, the following example opens a list of parish invoicing with the selection by the field number equal to 333.

Code 1C V 8.2 UP Viotab \u003d New Structure ("Number", "333");
Parameters Customer \u003d New Structure ("Selection", LaborBaby);
Open form ("document. GrittyNaster. Formatic", parameters!

Second way

You can open the list form without parameters:

Code 1C V 8.2 UP Opener ("Document. Greater-Knowledge. Formatic");

And then, in the event handler, the list of the list of arrival overheads will serve the server, which creates a selection in a dynamic list, which is the main details of the form:

Code 1C V 8.2 UP & Nasserver
Preservation procedure (failure, standardworking)
Elementotor \u003d list. Options. Elements. Addly (type ("elementotorbone-block"));
Elementatub. Lowerness \u003d new half-blooded ("number");
Elementatub. Vidolation \u003d vocational assemblyCompon.
Elementatub. Using \u003d truth;
Elementator.Rezhymographed \u003d modular procedures. ElementNewsCompon.
Elementatub. Actuation \u003d "000000001";
Extrudresses

The advantages of this method is that the selection should be specified not only as in the first case, and more, less, etc.

But this method has a very significant disadvantage: with this selection the form will always be opened. From where it would be called. Therefore, this form should not be prescribed the main one. And if nevertheless it is the main one, before installing the selection, it is necessary to provide some kind of analysis of where this form opens. For example, analyzing form parameters.

Third way

Finally, the selection condition can be placed in an arbitrary request, selecting data for a dynamic list.

For example, we need to open a list of parish invoices, in which a nomenclature has been present in the list of nomenclature.

To do this, in the form of a list of the nomenclature, we will create a command and the corresponding coming overhead button.

The execution handler of this command is filled as follows:

Code 1C V 8.2 UP & Clause
Property Procedure (Team)
Parameters Captivity \u003d New Structure ("FilterPotor", Elements. Site. Candles);
Open form ("document. GrittyNaster. Formatic", parameters!
Extrudresses

In this handler, we open the list of the list of arrival invoices, passing a link to the current item in the list of the nomenclature in the form.

Then create the form of the list of documents. Parcels and create a form parameter to the filterpoter, which we will use to open a form with the desired selection.

Now open the properties of the Property Properties of the Properties list. Set the flag of the arbitrariness and in the row setting the list click open.

In the Request field, you enter the following query text:

Code 1C V 8.2 UE Select
Document factory. Maker,
Document Company. Data.
OF
Document. Greater coordinate as Document Company
WHERE
Document factory. Tasters. Tier \u003d & Product

In the query, we use the item parameter in which the reference to the current line will be transmitted in the list of the nomenclature list contained in the list form of the list of the receipt filter filter.

To do this, in the Event Handler, the driver forms will write the code to set the query parameter value. Goods:

Code 1C V 8.2 UP & Clause
Operating procedure (refusal)
List. Parameters. Installingparameter ("Product", Parameters. Filterpotor);
Extrudresses

Here is the list. Parameters are a list of dynamic list request options for props list. The value of the product is set to equal value of the form parameter to the filterpoter.

As a result, by pressing the button, the receipt overheads in the form of the list of the nomenclature, we will receive a list of only those parcels in which the nomenclature has been present currently in the list of nomenclature.

The program opening of the forms in the 1c managed application is significantly different from their opening in the usual application. Consider for the beginning of the old method. It consists in obtaining a form and its subsequent opening in the usual or modal mode (when opening in modal mode, the form blocks the operation of the program).

Options (). Open()

This is the slowest method of opening forms. However, it allows you to programmatically process the form before opening. For processing code you need to change a bit:

Form \u003d Options ( "Document. Not Dumstive Outlook.) ;
// here perform actions with the form
The form. Open ();

It should be borne in mind that when a form is obtained, another event procedure will be performed. Departureer.

Consider other methods that allow you to open forms in the 1C managed application faster and more convenient. Depending on the specific situation, different methods can be used.

1. How to open the form of an object in a managed application, if there is a link to it.

In this case, everything is extremely simple.

Sprlink \u003d reference books. Nomenclature. Found contact ("000000001");
Open-ending (sprink);

2. How to open the selection form and get the selected value later.

For this, there is a function Introduction ().Function 3 parameters:

  • The variable in which the selected value will be recorded;
  • Tip, which will be displayed in the selection window;
  • Description of types of selected values. There may be several types, then before selecting a specific value it will be proposed to choose the type.

As a result of the execution of the function, the default selection form will open for the object of the specified type.

Mot value;
Array \u003d new array;
Array. Add (type ( "DANDERTRICT TRAINUSLANDS.NOBLATURE") ) ;
Array. Add (type ( "DANDERTRICT TRANSFER. CONTRUGENTS") ) ;

Descriptions \u003d New descriptions (array);

Res \u003d Introduction (value, "Tip", descriptions);

Previous methods allowed to open only forms set for default objects (object form or selection form). If you need to open an arbitrary form, you can use the function Openform ().

This feature has quite a few parameters. Consider some of them:

  • Form name - Here you can choose either one of the standard forms of the object, for example, Formscreenor Formsick. Or a specific form created by developers.
  • Parameters - allows you to transfer to the form in the form structuressome parameters before it is discovered, thereby defining the output data. Parameters can be any data that can be transmitted from the client to the server. Parameters allowed when opening the form can be processed in the procedure. PromotionServer () At the open form.
  • Opening mode of form- It has 3 options: independent, block the entire interface, block the shape of the owner.

Consider how the function applies Openform ()in various situations.

3. How to open the form of an existing object

Each form has one key props. It is highlighted in fat in the list of form details and is usually called An object For the forms of elements of reference books, documents. Other objects have a name to be different. To open the form of an existing object, you need to transfer the parameter to the above form. Keywith the value in the form of reference to the object.

& Svalette
Procedure Team1 (Team)
Parameter \u003d new structure;
Parameter. Insert ("key", find ());
Open form (, parameter);
Extrudresses

&On server
Function function ();
Return reference books. Counterparties. TOPOREKVISITE ("INN", "745107734623")
Endfunction

4. How to open the form of a new object

It will simply fit the function Openform () Without any parameters.

& Svalette
Procedure Team1 (Team)
Openform ( "Directory. Constrargents. Formabject") ;
Extrudresses

5. How to open the form of a new object and fill it on the basis of something

You need to transfer the parameter Base, whose value will be referenced to the Filling Object. The procedure will be launched Processpost ().

& Svalette
Procedure Team1 (Team)
Parameter \u003d new structure;
Parameter. Insert ("base", reflexpoxpiector);
Openform ( "Document. UpoalizerShud.FormAbject", Parameter);
Extrudresses

This example creates a document. Realization of goods and services And filled on the basis of an account for payment to the buyer, the link to which was transferred.

6. How to open the shape and set the selection on it

Selection on 1c forms may be simple and complex. Simple selection involves type expressions Organization \u003d LLC "Rog and hooves".Complex selection assumes other types of comparison, for example, In the list. In this article, consider the organization of simple selection, and a separate article will be devoted to the complex.

To organize a simple selection, you need to pass the key parameter in the open form SelectionThe value will be the structure in which the key is the name of the dynamic list field, and the value is the desired data.

For example, open the form of the list of reference book. Nizhtd. And we will take the selection by the owner - the element of the directory Nomenclature.

& Svalette
Procedure Team1 (Team)
Parameter \u003d new structure;

Selection \u003d new structure;
Selection. Insert ("owner", reflexionenenclature);

Parameter. Insert ("selection", selection);

Openform ( "Handbook.NameGTD. FAQ", Parameter);
Extrudresses

7. How to open an information register form

To do this, you need a key entry record.

Encording key- These are the values \u200b\u200bof all measurements and the period (if the register is periodic). That is, the record key is the parameters for which you can unambiguously identify the record.

The discovery algorithm is as follows:

  1. We enter the key entry data with the necessary values.
  2. We place the resulting structure into an array.
  3. From the array create a record key.
  4. We transmit parameter to the above form Keywith a record key from p.3 as a value.

& Svalette
Procedure Team1 (Team)
Parameter \u003d new structure;

ParametersClick \u003d new structure;
Conference. Insert ("nomenclature", reflexionenenclature);
Conference. Insert ("Titzen", Link Natipzen);
Conference. Insert ("period", date);

Massifable \u003d new array;
Massigute. Add (parameters);

Key cluck \u003d new ( "RegisterClocked Wounds. Sennomenclature", Massifable);

Parameter. Insert ("key", key);

Openform ( "Registerings. Tannomenclature. FormApisi", Parameter);
Extrudresses

In order to open the selection form with selection in 1C 8.2 (Ordinary forms), we need to perform some actions. First we get it. After that, put the selection and programmatically open, here is an example code:

Selection on form in the input field 1C 8.2 with several values

In the example above, we considered how to install selection on the form of choice Specific value. Now let's consider the situation when you need to substitute several values, it can be for example a array and unloading from the query result. This selection in the input field 1c with several values.

To begin with, we obtain the selection form, send the "Element" settings, set the selection mode flag. Then create a list of values \u200b\u200band an array, note that as a selection when the type of comparison is set in the list, the object can be present only with the type. Slip list. Add items to an array, then this array is loaded into the list of recognition that, as a result, we set in the selection. We also do not forget to enable the use flag of this selection, and install the vocabulary.

Setting the selection in the input field in 1C 8.3, start-up event

Now consider selection in the input field on a controlled form in 1C 8.3. Find on the form of an element of interest to us in which we will set the selection, in our case this field "Organization". We find the starting event, click on the magnifier and turn out to be in the procedure. We see the data parameter, this parameter has a type of list. In order to limit the choice of the necessary elements, we need to fill the list of accommodation. We can only select items on the server, so we create a procedure with a compilation directive & nasserver. In this procedure, fill in this data.

How to open a list form with some selection?

There are several ways to open a list form with some, pre-installed selection. Consider them in order:

1. The first method is that when the form is opening, you can set the form parameter, and open the list form with this parameter. The selection parameter is a structure. The names of the elements correspond to the names of the fields for which the selection is made, and the values \u200b\u200bcontain the selection values. This is the parameter extension of the managed form of the dynamic list. That is, it exists in forms, the main props of which is the type props Dynamic list, for example, in the forms of the list and forms of choice.

In the process of opening the form, the selection will be set at the specified field. For example, the following example opens a list of parish invoicing with the selection by the field number equal to 333.

Valitation \u003d New Structure ("Number", "333");

Parameters Customer \u003d New Structure ("Selection", LaborBaby);

Open form ("document. GrittyNaster. Formatic", parameters!

2. You can open the list form without parameters:

Openform ("document. GrittyNaster. Flag");

And then, in the event handler, the list of the list of profitable invoices Saviorserver Write a code that creates a selection in a dynamic list, which is the main details of the form:

&On server

Preservation procedure (failure, standardworking)

Elementotor \u003d list. Options. Elements. Addly (type ("elementotorbone-block"));

Elementatub. Lowerness \u003d new half-blooded ("number");

Elementatub. Vidolation \u003d vocational assemblyCompon.

Elementatub. Using \u003d truth;

Elementator.Rezhymographed \u003d modular procedures. ElementNewsCompon.

Elementatub. Actuation \u003d "000000001";

Extrudresses

The advantages of this method is that the selection should be specified not only as in the first case, and more, less, etc.

But this method has a very significant disadvantage: with this selection the form will always be opened. From where it would be called. Therefore, this form should not be prescribed the main one. And if nevertheless it is the main thing - before installing the selection, it is necessary to provide some kind of analysis of where this form opens. For example, analyzing form parameters.

3. And finally, the selection condition can be placed in an arbitrary request, selecting data for a dynamic list. For example, we need to open a list of parish invoices, in which a nomenclature has been present in the list of nomenclature.

To do this, in the form of a list of the nomenclature, create a command and the corresponding button Parcels.

The execution handler of this command is filled as follows:

& Svalette

Property Procedure (Team)

Form cleaner \u003d Optional ("Document. GrittyNaster. Formscribe");

Form cleaner. Filterpotor \u003d elements. Site. Costs;

Form cleaner. Open ();

Extrudresses

In this handler, we obtain the form of the list of arrival invoices and transmit a link to the current element to the form in the form parameter in the nomenclature list and open the form with this parameter.

Then create the form of the list of documents Purchase Invoice And create props the form of filterpoter, which we will use as a form parameter when opening it. Now open the properties of the Property Properties of the Properties list. Set flag Arbitrarily And in the string Setting up a list Click open.

In the Request field, enter the following query text:

CHOOSE

Document factory. Maker,

Document Company. Data.

OF

Document. Greater coordinate as Document Company

WHERE

Document factory. Tasters. Tier \u003d & Product

In the query, we use the item parameter in which the reference to the current line will be transmitted in the list of the nomenclature list contained in the list form of the list of the receipt filter filter. To do this, in the processing of the opening list form, we will write the code to set the value of the query parameter. Goods:

& Svalette

Operating procedure (refusal)

List. Parameters. InstallingParameter ("product", filterpoter);

Extrudresses

Here List. Parameters - This is a list of dynamic list request options for the props list. The value of the product is set to equal value of the form parameter to the filterpoter.

As a result, by pressing the button Parcels In the form of a list of nomenclature, we will receive a list of only those receiving invoices in which the nomenclature has been present on the date in the list of the nomenclature.

The demonstration example for the 3rd option is located in the 1cits / EXE / FAQ / open formampor directory.dt. An example is made on the platform version 8.2.9.356.