1C download the table of values \u200b\u200bto the table part. So everything is simple

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 ("number"); // 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.

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.

The storekeeper needs to unload the list of the entire nomenclature that the removal is not installed. Unloading fields:

  1. Name.
  2. Vendor code.
  3. View of the nomenclature.
  4. Type of nomenclature.

This will look like an Excel table after unloading:

Consider two ways to solve: without programming and with the participation of a programmer.

Programming

To unload the nomenclature in the XLS file form a database request to obtain a nomenclature and place the result in the table part of the unloading processing. Here is a form of processing:

By clicking on the "Fill" button, the table part of the "Data" of the processing is filled in which the corresponding details are added. The handler of this button has the following program code:

Procedure Plugging (button) Query \u003d New request; Inquiry. Text \u003d "Select | Nomenclature. Link as a nomenclature, | Nomenclature. Vendor code, | Nomenclature. Vinnomenclature, | Nomenclature. Vinnomenclature. Tinetritus as standardenamenclature |OF | Directory . Nomenclature as nomenclature | Where | Not a nomenclature. Petchildren | And not a nomenclature. This group"; Tablesdays \u003d query. Run (). Upload (); data loads. Download (tabletes); End Control

Everything should be clear here. The most interesting starts by clicking on the "Save" button. First, the path selection dialog is called to save the XLS table. Then, using the data in the tabular part of the processing, the tabular document is filled by a layout previously created. The layout added to the processing is as follows:

Procedure Basic Emergency Formation (Button) // Call the file selection dialog to save the XLS table Mode \u003d Mode Alignment. Preservation; Dialogotkrytiyla \u003d new dialogueborafyle (mode); Dialogotkrytiyala. Fullness \u003d ""; Dialogotkrytiyala. Multiple-based \u003d lies; Text \u003d "RU = "" XLS table "" ; en \u003d"" Xls table "" "; filter \u003d NSTR (text) +" (*. XLS) | *. XLS."; Dialogotkrytiyl. Filter \u003d filter; dialogotkrytiyl. Title \u003d" Select the path to save"; If the dialogotkrytihila. Choose () then the pulpail \u003d dialogotkrytiyl. The full empty; otherwise the text \u003d" The save path is not selected!"; Warning (text); refund; ended; // Create a tabular document Table Acquisition \u003d New Timber; // Get the layout of filling and layout area Layout \u003d This object. Receiving (" TableSlobes"); OblastSchap \u003d layout. Options (" Cap "); Oblast \u003d Layout. Optional Line" ) ; // Display data in a tabular document Table Acquisition. Withdraw (register); For each page of this data, the cycle of filling out the following (Oblast. Parameters, page); Table Acquisition. Output (oblast); EndCycle; // Save the table document on the disk Table Acquisition. Write (pull-up, typidate tree. XLS); Extrudresses

After saving, the Excel table file with a list of unloaded nomenclature on the disk. An example of a file you could see at the beginning of the article.

The user can self

In fact, the fate of the programmer for such a task is not necessary. The user can do without any tricks.

For example, by clicking on the list of nomenclature and executing the command "All Actions" -\u003e "List" From the list of nomenclature, the user will receive a list of nomenclature in the formed tabular document.

After the tabular document is formed by clicking on the "Save" button or through the "File-\u003e Save" menu, the user can record a tabular document to the XLS file specifying its name and end directory.

That's all! No processing for unloading is not needed. Of course, if you have a fairly simple case with data unloading.

So everything is simple?

Indeed, everything is simple, no external component is needed. In addition, we can unload in this way not only in Excel table format files, but also other formats supported by the platform.

Processing with an example from the article you can Download the link.


Top.