the Internet Windows Android

Selection in the 1C 8.2 values \u200b\u200btable. What methods exist and how to search simultaneously in several values

In order to take into account money and goods, various tables use widely in business. Almost every document is a table.

The table lists the goods to shipment from the warehouse. In another table - obligations to pay for these goods.

Therefore, 1C prominent occupies work with tables.

Tables in 1C are also called "tabular parts". They have reference books, documents and others.

The request as a result of its execution returns a table, access to which it is possible to get in two different ways.

The first is faster - sampling, obtaining rows from it only in order. The second is unloading the result of the query in the values \u200b\u200btable and further arbitrary access to it.

// Option 1 - Sequential access to the results of the query

// Receive Table
Sampling \u003d query. Fill (). Select ();
// in order we go around all the rows of the query result
While sample. Next () cycle
Report (sample. Name);
EndCycle;

// Option 2 - unloading in the table of values
Request \u003d new query ("Select the name from the Directory. Namenclature");
// Receive Table
Table \u003d query. Fill (). Unload ().
// then we can also get around all the lines
For each row from the table cycle
Report (string. Name);
EndCycle;
// or arbitrarily access to lines
Line \u003d Table. Init ("shovel", "name");

An important feature is in the table that is obtained from the query result, all columns will be strictly typed. This means that by requesting the name field from the directory Nomenclature, you will receive a column of a string type with a permissible length of no more than N characters.

Table on the shape (thick client)

The user works with a table when it is placed on the form.

The basic principles of working with forms, we discussed in the lesson in the lesson in

So, place a table on the form. To do this, you can drag the table from the control panel. Similarly, you can select the form / insert control in the menu.

Data can be stored in the configuration - then you need to select an existing (previously added) table part of the configuration object whose shape you edit.

Press the "..." button in the data property. In order to see a list of tabular parts, you need to reveal the branch object.

When choosing a tabular part 1C itself adds columns at the table on the form. Rows entered by the user in such a table will be saved automatically along with the reference / document.

In the same property, you can enter an arbitrary name and select the type of table.

This means that an arbitrary table of values \u200b\u200bis selected. It will not add automatically columns, it will not be automatically saved, but it is possible to do with it anything.

By right-clicking on the table you can add a column. In the column properties, you can specify its name (for referring to 1C code), the column header on the form, the connection with the details of the tabular part (last - if not an arbitrary table, and the table part is selected).

In the properties of the table on form, you can specify whether to add / delete lines to the user. A more advanced form - a tick only. These properties are convenient to use to organize tables intended to display information, but not editing.

To manage the table, you need to display the command panel. Select the menu item Form / Insert control / command panel.

In the command panel properties, select a tick autofill that the buttons on the panel appear automatically.

Table on the shape (thin / managed client)

On managed form, the specified actions look a little differently. If you need to place on the shape of the tabular part - open the branch of the object and drag one of the table parts left. And all!

If you need to place the table of values, add a new form props and in its properties. Specify the type - the table of values.

To add speakers, use the menu on the right mouse button on this details of the form, the option add a propumes column.

After that, also drag the table left.

In order for the table to appear command panel, in the table properties, select the values \u200b\u200bin the Use section - the command panel position.

Disload Table in Excel

Any table 1C, located on the form, can be printed or unloaded into Excel.

To do this, right-click on the table and select Display List.

In the controlled (fine) client, similar actions can be performed using the All Actions / List menu item.

Table of values \u200b\u200bin the 1C 8.3 platform (8.2) is a universal collection of the values \u200b\u200bthat the developer can use when software develops to implement its algorithms. In fact, the 1C values \u200b\u200btable is a dynamic set of values \u200b\u200bhaving columns and columns.

Articles about other universal collections of 1C values

Explore programming in 1C in place from my book "Program in 1C for 11 steps"

  1. The book is written by understandable and simple language - for a beginner.
  2. Learn to understand the architecture of 1C;
  3. We will write code in 1C language;
  4. Light the main programming techniques;
  5. Secure the knowledge gained using the task;

Excellent development allowance in a managed application 1C, both for beginner developers and experienced programmers.

  1. Very affordable and understandable language of presentation
  2. The book is sent to an email in PDF format. Can be opened on any device!
  3. You will understand the ideology of the managed application 1C
  4. Learn how to develop a managed application;
  5. Learn to develop managed forms 1C;
  6. You can work with the main and necessary elements of controlled forms.
  7. Programming under a managed application will become understandable

Promo code for a discount of 15% - 48pvxheyu.


If you helped this lesson to solve some problem, I liked it or was useful, then you can support my project, listened to any amount:

you can pay manually:

Yandex.Money - 410012882996301
Web Money - R955262494655

Join my groups.

Table of values \u200b\u200bis a specific universal object designed to store data in a tabular view. The key difference of the table from applied objects is the lack of binding to the physical database tables. The values \u200b\u200btable exists only in RAM, which on the one hand gives unique opportunities, and on the other, it imposes certain limitations. Nevertheless, the possibility of interaction with the table is comparable to the interaction with the objects actually existing in the database.

Historically, the value table in 1C has a dual purpose, being a virtual analogue of existing tables, but at the same time - and controls element. With the transition to the controlled application, most of this functionality is outdated, but also at present it can also be an element of the user interface, but with a number of significant restrictions.

Structure of the table of values \u200b\u200bas an object

The properties of the values \u200b\u200btable are determined by combinations of two predefined collections: its columns and rows.

Table of speaker values

Column Table of values \u200b\u200b- its defining property. It is a set of table columns determines its structure. The columns match the fields of physical tables or familiar to the user interface columns tabular part or documents log. The column may have an internal name, the value of the value and the title displayed during interactive working with the table.

Since the columns are a collection of objects, you can add, delete and edit columns.

Row of table of values

From the point of view of the software interface, the string is a separate collection built into the values \u200b\u200btable. They are analogous to the records of physical tables, that is, the usual lines of the table part or the log log. Each separately taken line is an object with a set of named properties whose names correspond to the names of the table columns.

Thus, interaction with the string is very similar to the interaction with other objects. You can read and write its properties, including using the predefined function of "filling out the following ()". Since the lines are the main collection of the values \u200b\u200btable, then to delete all rows of the table, the "Clear ()" method applies.

Create a table of values

There are many ways to get the table of values \u200b\u200bready for use. Consider some of them. Each example will be given as the listings of the code with comments.

Creating a table designer

The main way to create just such a table that is needed by the developer, unfortunately, the most time consuming, since it requires manually by manually all the necessary properties of the table.

Demotable \u003d new tables; // First of all initialize TK // Next, we define the necessary parameters for new columns and add them to the collection // Creating a "Nomenclature" column name \u003d "Nomenclature"; Type Type \u003d New Description ("DirectoryAds.Nanklatura"); Title \u003d "Nomenclature (product)"; Demotablik. Cutouts. Addly (to them, title, title); // Creating a column "Number" Name \u003d "Number"; Type title \u003d new descriptions ("number"); Demotable. Cutouts. Addly (name, title); // As a result of data of manipulations, we have created an empty table with typed columns // If you need to use more accurate typing of primitive types, you should use the advanced syntax of the Designer Designer "Desigraticles"

Creating a copy table

If your hand has a standard with a suitable structure and / or composition, you can copy or unload the reference table of values. If the reference is another table, you must apply the "Copy Stand Table" method. If you are dealing with a table part or a set of register entries, you need to use the "Upload Table Table" method. If you need only a structure, you can use the "Copying Collection" method.

// Option with copying from the TK standard of all rows, but with the preservation of only the two specified columns of the columnalone \u003d "Nomenclature, number"; Demotable \u003d TableThetalon .Copy (, columnal); // Option with copying from the TK standard of pre-selected rows, while maintaining the two specified columns of the stringalone \u003d selected by the machine-to-thenemstroyistalkyetalone (); Columnalone \u003d "nomenclature, number"; Demotable \u003d TableThetalon .Copy (rowetal, columnal); // Option with copying from TK-Strelna Rows by the specified filter, while saving one column "Nomenclature" // All lines will be selected where the value in the column is equal to 0, only the column of the nomenclature of the remedies will fall into the resulting table ("Quantity" 0); Columnaltalon \u003d "nomenclature"; Demotable \u003d TableThetalon .Copy (rowetal, columnal); // Option with full copying of the table and the subsequent removal of one row with the field value of the quantity of zero is zero and the removal of the whole column "Number" of the counterpart \u003d New Structure ("Number", 0); Columnaltalon \u003d "nomenclature"; Demotable \u003d TableThetalon .Copy (rowetal, columnal); Strifices \u003d Demotable .Night (0, "quantity"); Demotable. Delete (strifices); Demotablik. Solonki.Deel ("quantity"); // Similar options and their modifications can be applied to tabular parts and sets of registers

Creating a table inquiry

If there is a reference table in the database, you can use the query to quickly create a table with the desired structure.

// Example with the creation of an empty table according to the sample structure of the accumulation register // It is not difficult to guess that in this way you can get the filled table request \u003d a new query ("choose the first 0 * from the register. Turning station"); RESULT SUPPLY \u003d Query. Fill (); Demotable \u003d result recruitment. Download (); // Example with the creation of an empty table by explicitly specified types and names of the fields query \u003d a new request; Request.text \u003d "Select the first 0 | meaning (reference book. Substitution. Power roll) as a nomenclature, | express (0 as a number (15, 3)) as a quantity"; RESULT SUPPLY \u003d Query. Fill (); Demotable \u003d result recruitment. Download (); // IMPORTANT! You should not forget that in the types of speaker values \u200b\u200bobtained from the query is always present type NULL // Thus, the TK created by the query always has composite types of columns

Conclusion

In this small article, we reviewed the basic properties and practical techniques for creating a table of values \u200b\u200bsufficient to understand and start application. The object of the table of values \u200b\u200bitself is so multifaceted that a detailed description of its capabilities requires writing a separate article on receptions and methods of work.

Greetings all readers Infostart'a. This article will be devoted to the creation of an arbitrary table of values \u200b\u200bon the form of a managed application programmatic method.

Features of the task.

Everyone who programmed in the usual appendix often faced the task of obtaining an arbitrary table of values \u200b\u200bon the form. Under an arbitrary table of values \u200b\u200bis understood as the table, the number and type of columns of which is not known. That is, the columns can be 3, and maybe 6, or maybe 8. In the usual application, everything is simple: it was possible to place the "table apposition" element on the formation form, and then transfer the value table to the values \u200b\u200bto this item to this item. Then a simple team:

Elementforms. Ticketpassed. Calcons ();

get a ready-made table of values \u200b\u200bon the form. It would seem that it could be easier.

It was all in the usual application. In the managed application everything has changed. So simply an arbitrary table not to create. Now you need to either rigidly parametrate the table of values \u200b\u200bon the form, or create it programmatically (describe, well, in this, in fact, the essence of the authorized application itself). We will try to do: create an arbitrary table of values \u200b\u200bon a managed form.

The solution of the problem.

The first thing we have to do is determine how the table appears on the form. The main thing is that no element of the form in the processing is not necessary. We will create it programmatically, like the entire table. That is, the table will be described, and to create at the time of opening the form or using the button - this is how it is necessary.

Creating a table on the form occurs through the description of the table of values \u200b\u200bas requisition:
Massiferboabor \u003d new array; Massifable customer. Addly (type ("table apposition")); DescriptionCarebar \u003d New descriptions (massifacivity); Massives \u003d New array; Massives. Addly (new requisite ("tablescript", descriptions, "", "TZN")); Now we have to create a software table of values \u200b\u200bthat contain data. If the value table is obtained from the request, then everything is less than the order. If the table is created manually, the value of the speakers that will contain numbers or dates can be created through the "Description". The bottom line is that the columns in the table of values \u200b\u200bmust have some kind of type. If, for example, it is assumed that the user will fill in the data in these columns interactively, then you cannot add the values \u200b\u200bof the values \u200b\u200bcolumn simply with the name, it should be type. Keep in mind - this is very important because We will give these types to the table on the form.
Create a table that contains several columns:
KD \u003d new qualificatory dates (particles. Veria); Massigs \u003d new array; Arms. Addly (type ("date")); Lookup graphics \u003d New descriptions (arms, CD); TK \u003d new tables;
TK.Colonki. Addly ("C", descriptions.
TK.Colonks. Addly ("to", descriptions.
TK.Colonki. Addly ("FULL NAME");
TK. Solonks. Addly ("Note"); // FULL NOTE - Rows Next, we will fill our software table TK with the necessary data. We obtain the TK table that contains the necessary values \u200b\u200band is ready for transmission to the created props of form. For each column of TK. Column cycle

Massiverevizites. Addly (new requisite (column. I mean, column. Type, "Taxcripts"));
EndCycle;
Changerevizes (massivevizites);
TablePoles Captivity \u003d Elements. Addly ("TZN", type ("tableform"));
TablePoles Capture. Powded \u003d "Taxcripts";
TablePoleSeboat. Example \u003d Displayed. Opportisses;

Here is such a simple combination and our table is ready.

For each column of TK. Column cycle

NewElent \u003d Elements. Addly (column. I mean, type ("Foreform"), TablePoles);
New element. Vid \u003d Vidpolar Form. Power;
New element. Powdly \u003d "Taxcripts." + Column.
New element.shirina \u003d 10;
EndCycle;

Conditional design, if we need we also write manually, command menu - manually. Table handlers are also written with hands. For example, to add an event handler "Selection" event:

TablePoles Capture. Setting ("Choice", "Tznvybor");

To process this event, a separate procedure is prescribed in the form of the procedure:

& Svalette
Procedure TZNVSB (TK, selected, field, standardworking)
// Processor Commands End Controlments

Please note that the table handlers are triggered on the client and therefore must have a compiler pointer command

& Svalette

Well, and the last thing I wanted to add that after all these actions, we definitely do not forget to transfer the finished table into the requisition of the form:

Recentlyrerevisitforms (TK, "Taxcripts");

Here is what we have as a result:


But the processing of the Event "Choice":



Afterword.

I hope the article will assist those programmers 1C, which begin to create tables on the form of the programmatic method.

You can download the processing that software creates a value table and displays a managed form with comments that will help you create your own tables.

Search in 1c values \u200b\u200btable

What methods exist and how to search simultaneously in several values.

To search in the table of values \u200b\u200bthere are two special methods:

1. Find

TVGorizont \u003d reference books. Nomelaclature. Intepponation ("TV horizon");
Results \u003d Tznenenclature. Inite (TV, TV);
// Also we can specify in which speakers to search to speed up the search
Foundation \u003d Tznomenclature. Inite (TV, "Nomenclature");

This method returns the first found line with the desired value or undefined if it does not find. Therefore, it is convenient to use it to search for unique values, because Otherwise, you will have to delete it from the table when finding the following.

In order not to suffer, there is the following method that allows you to find an array of suitable lines:

2. Flight


Structuralboration. Hold ("Nomenclature", TVGorizont); // First, specify the column where to look for, and then what to look for.

This method always returns an array, but it can be empty if nothing is found. And this method also, as well as the previous returns the rows of the values \u200b\u200bof the values, and not the values \u200b\u200bthemselves in a separate array. Therefore, changing the values \u200b\u200bin the array row or in the previous method at the found line, you will change the value in the table of values \u200b\u200bprocessed.

The more good this method is that it can search at once in several columns of the values \u200b\u200btable at the same time:


Structures \u003d new structure;
Structuralboration. Hold ("Nomenclature", TVGorizont);
Structuralboat. Hold ("quantity", 10);
FoundationMassivests \u003d Tznenenclature. Entries (structures);

The only minus, as can be seen, can not be used other comparisons except "equal"