Tabular parts exist for many objects in 1C:

  • Directories
  • Documents
  • Reports and processing
  • Charts of accounts
  • Characteristic type plans
  • Calculation type plans
  • Business processes and tasks

Tabular parts allow you to store an unlimited amount of structured information belonging to one object.

Let's look at some techniques for working with tabular parts.

How to bypass the tabular part

To traverse the table part, you can use a loop For everyone

For each Row from the Tabular Part of the Cycle

Report(String. TabularPart Attributes) ;

EndCycle ;

At each iteration into the variable Line The next row of the tabular section is transmitted. The values ​​of the row details can be obtained by the expression Line.AttributeName.

How to get and bypass selected rows of the tabular part

To display information from the tabular part of an object, use a form element Table field. To enable the ability to select multiple rows in a table field, you need to set the value Multiple at his property Selection mode.

To get a list of selected lines, use the following code:

To iterate through the selected lines, use a loop For everyone:

SelectedRows = FormElements. TableFieldName. SelectedRows;

For each Row from Selected Rows Loop

//loop contents

EndCycle ;

How to programmatically select rows of a tabular part (table field) and deselect them

To programmatically deselect rows of a table field:

Form Elements. TableFieldName. SelectedRows. Clear() ;

To programmatically select all rows of a table field:

For each CurrentRow From TabularPart Loop
Form Elements. TableFieldName. SelectedLines. Add(CurrentRow) ;
EndCycle ;

How to clear the table part

TabularPart. Clear() ;

How to get the current row of a table section

The current line is the timeline in which the user currently has the cursor. To get it, you need to access the control element on the form that is associated with the tabular part.

For regular forms the code will look like this:

Form Elements. TableFieldName. CurrentData;

For managed forms:

Elements. TableFieldName. CurrentData;

How to add a new row to a table section

Adding a new line to the end of the table section:

NewRow = TablePart. Add() ;

Adding a new line anywhere in the table section (subsequent lines will be shifted):

NewRow = TablePart. Insert(Index)
//Index - number of the added line. Line numbering starts from zero.

NewRow. Props1 = "Value" ;

How to programmatically fill in the details of a table row

If you need to programmatically fill in the details of a tabular section row that the user adds, you must use the tabular section event handler When StartingEditing.

The procedure created by the handler has three parameters:

  • Element- contains a control element TabularField.
  • NewString- boolean. Contains value True, if a new table row is added, and Lie, if the user started editing an already existing line.
  • Copy- boolean. Contains value True, if the user copies the line, and Lie in other cases.

Let's look at an example. Let's say we need to fill in the details of the tabular section AccountAccount, in case a new line is added. When editing an existing line, you do not need to change the accounting account.

Procedure TabularPartAtStartEditing(Element, NewRow, Copy)

//If the user edits an existing line, then we do nothing
If NOT NewRow Then
Return;
EndIf ;

//If the line is new, set the accounting account
TechString = Item. CurrentData; //Get the current row of the tabular part
TechString. Accounting = Charts of Accounts. Self-supporting. RequiredAccount;
End of Procedure

The row number of the tabular section (document) is assigned based on the maximum number selected lines.

At the same time, the 1C program itself “shifts” the line numbers (the number of which WAS greater than or equal to the number of the just inserted line) so that there are no coincidences of numbers on different lines.

It turns out that you can insert a new row into the middle of the document table if you use the selection of rows in the tabular section. Or you can even insert a new row into the first position of the tabular part :) if the selection of the tabular part does not contain any rows.

How to assign a number to a new row based on the maximum number among all rows in the table section? It turned out that the RowNumber attribute is read-only even for newly added rows, so it is not possible to assign any value to it for a new row.

The simplest solution (and the most inconvenient for users) is to prohibit adding a row if selection is applied to the tabular part 🙂 but for users this restriction looks rather artificial (incomprehensible, “far-fetched”).

A slightly more complex solution is to call the Reset() method on the RowSelection collection of a table field (associated with the table part). Users can add a line, but the selection will fail. This is illogical and therefore not justified.

I solved this problem (“assign a number to the new row based on the maximum number among all rows in the tabular section”) by software resetting and restoring the selection of rows in the tabular section. In the form module (at the beginning of the module text) I declared a local variable locSelection1 Structure, at the very end of the module (in the section for initializing form variables) I initialized it:

locSelectionStructure1 = New Structure;

Work ProcedureBefore StartingAdding(Element, Rejection, Copying)



locSelectionStructure1.Clear();
For each Selection Element 1 From Selection Rows 1 Cycle
locSelectionStructure1.Insert(SelectionElement1.Name, SelectionElement1.Use);
EndCycle;

SelectRow1.Reset();

End of Procedure

Operation ProcedureWhenEditingStart(Element, NewLine, Copy)

// when selection is applied to the tabular part, the row number is assigned based on the maximum number of rows in the visible area!!!
// so first we will reset the selection and then restore it
// localSelectionStructure1 works as a transmission link between the procedures of WorkBeforeStartingAdding and WorkWhenEditingStart

Row Selection1 = FormElements.Work.Row Selection;

For each Selection Element 1 From Selection Structure 1 Cycle
RowSelection1[SelectionElement1.Key].Usage = SelectionElement1.Value;
EndCycle;
localSelectionStructure1.Clear();

End of Procedure

This whole “kitchen” is interesting only to those programmers who do not want users to change numbers by their actions existing rows in tabular parts of documents/reference books in certain situations. And this, in turn, occurs when the line number is written in some information register or somewhere else (i.e. the line number is used as a reference to a specific line of the document).

Each 1C solution on the 1C:Enterprise 8 platform has a wide range of capabilities. However, there are universal techniques that can be used in any configuration. With this article we are opening a series of publications in which 1C methodologists will talk about the universal capabilities of the 1C:Enterprise 8 platform. Let's start with one of the most important methods for increasing work efficiency - with a description of “hot” keys (actions from the keyboard, as a rule, are performed faster than those through the menu using the mouse). Having mastered the hotkeys, you will simplify the execution of frequently repeated actions.

Table 1

Action

Keyboard shortcuts

How the program works

Create a new document

Open an existing document

Open calculator

Opens the calculator

Show properties

Alt+Enter
Ctrl+E

Open message window

Close message window

Ctrl + Shift + Z

Open scoreboard

Opens the scoreboard

Open help

Opens help

Call up help index

Shift + Alt + F1

Calls up the help index

Hotkeys: global actions

Global actions are actions that you can perform in any program state. It does not matter what is currently open in 1C:Enterprise. The main thing is that the application is not busy performing any task.

Global actions are actions that can be called anywhere in the running 1C:Enterprise 8 platform. Regardless of what exactly happens in the running configuration, the meaning of global actions does not change (for example, pressing Ctrl+N will always bring up the dialog for creating a new document).

Table 1

Hotkeys for global actions

Action

Keyboard shortcuts

How the program works

Create a new document

Opens a window in which you will be asked to select the type of new document to create in various formats - for example, text, spreadsheet or HTML

Open an existing document

Opens the standard "Open" dialog box, accessible through the "File/Open…" menu

Activating the search field in the command bar

Places the cursor in this field

Open calculator

Opens the calculator

Show properties

Alt+Enter
Ctrl+E

Depending on what the cursor is placed on, it opens the corresponding properties palette for this object or element. Useful when working with tables, text, HTML, etc.

Open message window

Allows you to open a previously closed message window. It is often useful when a window is accidentally closed and you need a message from it. Please note: as long as the system has not entered anything into the message window again, old messages are retained even if the window is closed

Close message window

Ctrl + Shift + Z

Closes the message window when it is no longer needed. Please note: the combination is chosen so that it can be easily pressed with one hand

Open scoreboard

Opens the scoreboard

Open help

Opens help

Call up help index

Shift + Alt + F1

Calls up the help index

Hotkeys: general actions

General actions- actions that have the same meaning in different configuration objects, but the behavior of the 1C:Enterprise 8 platform changes depending on where exactly you use this or that general action. For example, pressing the "Del" key marks the current directory element for deletion if you are in the list of directory elements window. Or deletes the contents of the current cell of a spreadsheet document if you are editing it.

Table 2

Hotkeys for common actions

Action

Keyboard shortcuts

How the program works

Deletes the element under the cursor (current element) or the selected group of elements

Add

Allows you to add a new element

Saves the active document

Print the active document

Calls up the print dialog for the active document

Printing to the current printer

Ctrl + Shift + P

Initiates direct printing of the active document to the default printer assigned in the system (without opening the print dialog)

Copy to clipboard

Ctrl+C
Ctrl + Ins

Copies the required element or selected group of elements to the Windows clipboard

Cut to clipboard

Ctrl+X
Shift + Del

Cuts the required element or selected group of elements to the Windows clipboard. Differs from copying in that the copied element or group is deleted after entering the buffer

Paste from clipboard

Ctrl+V
Shift + Ins

Pastes existing data from the Windows clipboard into the location marked by the cursor.

Add to clipboard as number

Shift + Num + (*)

Used for numeric values

Add to clipboard

Shift + Num + (+)

Used for numeric values. Addition operation with data on the clipboard

Subtract from clipboard

Shift + Num + (-)

Used for numeric values. Subtraction operation with data on the clipboard

Select all

Undo last action

Ctrl+Z
Alt+BackSpace

Revert undone action

Ctrl+Y
Shift + Alt + BackSpace

Find next

Find next highlighted

Find previous

Find previous selection

Ctrl + Shift + F3

Replace

Ctrl + Num + (-)

Select all

Selects all available elements in the active document

Undo last action

Ctrl+Z
Alt+BackSpace

Undoes the last action taken

Revert undone action

Ctrl+Y
Shift + Alt + BackSpace

Allows you to undo “Ctrl + Z”, in other words - to return what you did before pressing undo the last action taken

Opens a dialog for setting search parameters in the active configuration object and performing this search

Find next

Finds the next element that matches the parameters specified in the search settings

Find next highlighted

Finds the next element that matches the one you selected (for example, where the cursor is placed)

Find previous

Finds the previous element that matches the parameters specified in the search settings

Find previous selection

Ctrl + Shift + F3

Finds the previous element matching the one you selected

Replace

Opens the Find and Replace Values ​​dialog (where allowed)

Collapse (tree node, spreadsheet document group, module grouping)

Ctrl + Num + (-)

Used where tree nodes marked with "+" or "-" are available

Collapse (tree node, spreadsheet document group, module grouping) and all subordinates

Ctrl + Alt + Num + (-)

Collapse (all tree nodes, spreadsheet document groups, module groupings)

Ctrl + Shift + Num + (-)

Expand (tree node, spreadsheet document group, module grouping)

Ctrl + Num + (+)

Expand (tree node, spreadsheet document group, module grouping) and all subordinates

Ctrl + Alt + Num + (+)

Expand (all tree nodes, spreadsheet document groups, module groupings)

Ctrl + Shift + Num + (+)

Next page

Ctrl + Page Down
Ctrl + Alt + F

Quickly scroll through the active document

Previous page

Ctrl + Page Up
Ctrl + Alt + B

Enable/disable fat content

Used where text formatting is supported and possible

Enable/disable italics

Enable/disable underlining

Go to previous web page/help chapter

Used in HTML documents

Go to next web page/help chapter

Abort execution of a data composition system report

Hotkeys: window management

This section combines hotkeys common to all windows and forms of the 1C:Enterprise platform.

Table 3

Hotkeys for managing windows

Action

Keyboard shortcuts

How the program works

Close an active free window, modal dialog, or application

This combination can quickly complete the entire configuration on the 1C:Enterprise platform, so use it carefully

Close active regular window

Closes the current normal window

Close active window

Closes the currently active window

Activate the next regular window

Ctrl+Tab
Ctrl+F6

Allows you to activate the following window among those open within the configuration. Pressing in a cycle while holding the Ctrl key allows you to scroll through open windows “forward”

Activate previous normal window

Ctrl + Shift + Tab
Ctrl + Shift + F6

Allows you to activate the previous window among those open within the configuration. Pressing in a cycle while holding the Ctrl key allows you to scroll through open windows "back"

Activate the next section of the window

Activates the next section of the current window

Activate previous window section

Activates the previous section of the current window

Call the system menu of an application or modal dialog

Allows you to see the system menu of operations (minimize, move, close, etc.) above the program window or open modal dialog

Call the window system menu (except for modal dialogs)

Alt + Hyphen + (-)
Alt + Num + (-)

Allows you to see the system menu of operations (minimize, move, close, etc.) above the active window

Call main menu

Activates the main panel with buttons for the current window. This way you can select actions without using the mouse

Call context menu

Displays a context menu above the currently active element. Same as right clicking on it

Return activity to normal window

Returns activity to the normal window after working with the context menu. Attention! In any other case, Esc initiates closing of the active window

Hotkeys: form management

Here are collected "hot" keys that simplify and speed up work with various forms that were created in configurations written on the 1C:Enterprise platform.

Table 4

Hotkeys for managing forms

Action

Keyboard shortcuts

How the program works

Move to next control/call default button

Move between controls on the form "forward" (see Tab)

Calling the default button

As a rule, different forms have a default button assigned (it is different from others - for example, it is highlighted in bold). Using this key combination allows you to activate the default button from anywhere in an open form

Move to next control

Navigate between controls on a forward form

Go to previous control

Moving between controls on the form "back"

Activates the command bar associated with the active control/form

Activates the main panel with buttons for the current form. This way you can select actions without using the mouse

Navigate through controls grouped together

Up
Down
Left
Right

Using the cursor keys you can quickly move between grouped controls

Close form

Closes the current form window

Restore window position

If some form window parameters are lost, this combination allows you to return everything back

Hotkeys: working with lists and trees

The hotkeys in this section will help you work effectively without using a mouse in numerous lists and trees that are actively used in various configuration objects on the 1C:Enterprise 8 platform.

Table 5

Hotkeys for working with lists and trees

Action

Keyboard shortcuts

How the program works

Opens the element on which the cursor is placed for editing. The key is similar to the "Edit" action on the standard form button bar

Update

Ctrl + Shift + R
F5

Updates data in a list or tree. This is especially true for dynamic lists (for example, a list of documents) when auto-update is not enabled for them

Copy

Creates a new list item using the current item as a template. Similar to the "Add by copy" button

New group

Creates a new group. Similar to the "Add group" button

Delete a line

Directly delete the current element. Attention! Use this combination with great caution in dynamic lists, as deletion cannot be undone

Move a line up

Ctrl + Shift + Up

In lists where line ordering is allowed, allows you to move the current line up. Similar to the "Move Up" button

Move a line down

Ctrl + Shift + Down

In lists where line ordering is allowed, allows you to move the current line down. Similar to the "Move Down" button

Move element to another group

Ctrl + Shift + M
Ctrl+F5

Allows you to quickly move the current element (for example, a directory) to another group

Go one level down while simultaneously expanding the group

Moves inside the folder where the cursor was placed

Go up one level (to "parent")

Goes to the top of the folder you were in

Finish editing

Completes editing a list item and saves the changes.

Stop searching

Aborts the search

Expand tree node

Used where tree nodes marked with "+" or "-" are available

Close tree node

Expand all tree nodes

Changing a checkbox

Inverts the value of the current element's checkbox (turns it on or off)

Hotkeys: input field

Input field- an actively used control element in many places in configuration forms. Hotkeys for an input field allow you to quickly perform frequently used actions on it. It is especially useful to use these keys where the configuration developer has not provided the input field control buttons you need.

Table 6

Hotkeys for the input field

Action

Keyboard shortcuts

How the program works

Similar to the behavior when editing regular text, it allows you to either add new characters to the old ones when entering, or overwrite the old ones with new ones

Select button

Selecting the appropriate object associated with the input field (for example, selecting the desired document from a list). Similar to the "Select" input field button

Open button

Ctrl + Shift + F4

Opens the form of the selected object in the current input field. Same as clicking the "Open" input field button

Clear field

Clear an input field from its current value

Working with typed text in an input field

Ctrl + BackSpace

Go to the beginning of the line

Go to end of line

Clicking the Mouse Pointer on the Up Button for an Adjustment Button

Use adjustment if enabled in the input field. For example, changing dates, counters, etc. Similar to pressing the "up" button of the input field regulator

Clicking the Mouse Pointer Down on an Adjustment Button

Use adjustment if enabled in the input field. For example, changing dates, counters, etc. Similar to pressing the "down" button of the input field regulator

Hot keys: image field

Picture field- this is a standard element of the 1C:Enterprise 8 platform for displaying graphic images. "Hot" keys will help, for example, to comfortably view an image located in the picture field.

Table 7

Hotkeys for the image field

Action

Keyboard shortcuts

How the program works

Zoom in

Scales the picture

Zoom out

Scroll

Up
Down
Left
Right

Moving around the picture

Scroll up window size

Scroll down window size

Scroll window size left

Scroll one window size to the right

Hotkeys: Spreadsheet Document Editor

This section contains hotkeys for a variety of spreadsheet documents. They can be very useful if you frequently edit data in such documents.

Table 8

Hotkeys for the spreadsheet editor

Action

Keyboard shortcuts

How the program works

Go to cell

Opens a dialog box to move to a cell with column/row coordinates

Moving through cells

Up
Down
Left
Right

Moves the cursor through table cells

Move through cells to the next filled or empty one

Ctrl + (Up, Down, Left, Right)

Moves the cursor through filled table cells

Selecting cells

Shift + (Up, Down, Left, Right)

Selects an area of ​​cells starting with the current one

Scroll up page

Flips through a spreadsheet document

Scroll down page

Scroll left one page

Scroll right one page

Go to editing cell contents

Enables cell content editing mode

Switching edit/input mode in a cell

Go to the beginning of the line

Moves the cursor to the beginning of the line

Go to end of line

Moves the cursor to the end of the line

Go to the beginning of the text

Go to end of text

Setting the name of the current area

Ctrl + Shift + N

Sets the name of the current cell area

Hotkeys: text document editor

Hot keys when editing text in text areas and documents can significantly speed up and simplify the process.

Table 9

Hotkeys for the text document editor

Action

Keyboard shortcuts

How the program works

Toggle insert/replace mode

Allows you to either add new characters to the old ones when entering, or overwrite the old ones with new ones

Go to the beginning of the line

Moves the cursor to the beginning of the current line

Go to end of line

Moves the cursor to the end of the current line

Select to start of line

Selects text to the beginning of the line

Select to end of line

Selects text to the end of the line

Go to the beginning of the text

Moves the cursor to the beginning of the text

Go to end of text

Moves the cursor to the end of the text

Select to start of text

Ctrl + Shift + Home

Selects from the cursor to the beginning of the text

Select to end of text

Ctrl + Shift + End

Selects from the cursor to the end of the text

Scroll up one line

Flipping through a text document

Scroll down one line

Go to the beginning of the previous word

Go to the beginning of the next word

Select previous word

Ctrl + Shift + Left

Quickly highlight a word (characters separated by spaces)

Select next word

Ctrl + Shift + Right

Scroll up page

Flipping through a text document

Scroll down page

Select previous page of text

Highlights text page by page

Select next page of text

Shift + Page Down

Deselect

Removes selection

Go to line

Moves the cursor to line number

Delete the character to the left of the cursor

Deletes the character to the left of the cursor

Delete the character to the right of the cursor

Deletes the character to the right of the cursor

Delete the word to the left of the cursor

Ctrl + BackSpace

Deletes the word to the left of the cursor

Delete the word to the right of the cursor

Deletes the word to the right of the cursor

Set/remove bookmark

Marks the line you need

Next bookmark

Moves the cursor between bookmarked lines

Previous bookmark

Delete current line

Deletes the current line

Move block to the right

Moves the selected block of text to the right

Move block to the left

Moves the selected block of text to the left

For the previous example, you can add the following lines of code:

Form Elements.TableField1.AddRow(); page = FormElements.TableField1.CurrentRow; p.First = 3; p.Second = "Flour"; p.Quantity = 350;

How to determine the number of rows in a table of values ​​in 1s 8?

countRows = table.Quantity(); Report("Number of rows in table of table values ​​= " + number of rows);

Result:

Number of rows in table of table values ​​= 3

How to delete a row in the value table in 1s 8?

rowTable = table; table.Delete(rowTable);

How to collapse a table of values ​​in 1s 8?

Collapse:

table.Collapse("Second", "Quantity");

We get after convolution:

How to sort a table of values ​​in 1s 8?

Sort by the second and third columns:

table.Sort("Second, Quantity");

How to position a table field on a line in 1c 8?

On the second line:

Form Elements.TableField1.CurrentRow = table;

Printable form in 1s 8

First, we make a layout (name of the area: select the required lines of the layout, in the properties, in the Name field, enter the name of the area), then display it in a spreadsheet document:

Procedure CommandPanel1Print(Button) variable td, rs, rs1, layout, code, name, nomen; code = 0; layout = GetLayout("Products"); header = layout.GetArea("Header"); header.Parameters.datta = CurrentDate(); rs = layout.GetArea("rs"); pc1 = layout.GetArea("pc1"); td = New TabularDocument; td.Output(cap); nomen = Directories.Nomenclature; selection = nom.SelectHierarchically(); while fetch.Next() loop code = code + 1; if sample.ThisGroup = True then pc1.Parameters.code = code; pc1.Parameters.name = sample.Name; td.Output(rs1); else rs.Parameters.code = code; rs.Parameters.name = selection.Name; td.Withdraw(rs); endIf; endCycle; etc.ViewOnly = True; td.Show("Directory ""Nomenclature"""); End of Procedure

In order to account for money and goods, various tables are widely used in business. Almost every document is a table.

One table lists the goods to be shipped from the warehouse. Another table shows the obligations to pay for these goods.

Therefore, in 1C, working with tables occupies a prominent place.

Tables in 1C are also called “tabular parts”. Directories, documents and others have them.

The query, when executed, returns a table that can be accessed in two different ways.

The first - faster - selection, obtaining rows from it is possible only in order. The second is uploading the query result to a table of values ​​and then random access to it.

//Option 1 – sequential access to query results

//get the table
Select = Query.Run().Select();
// we go through all the lines of the query result in order
While Select.Next() Loop
Report(Selection.Name);
EndCycle;

//Option 2 – uploading to a table of values
Request = New Request("SELECT Name FROM Directory.Nomenclature");
//get the table
Table = Query.Run().Unload().
//further we can also traverse all lines
For each Row from Table Cycle
Report(String.Name);
EndCycle;
//or arbitrarily access strings
Row = Table.Find("Shovel", "Name");

An important feature is that 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 Nomenclature directory, you will receive a column of the String type with an allowable length of no more than N characters.

Table on the form (thick client)

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

We discussed the basic principles of working with forms in the lesson on and in the lesson on

So, let's place the table on the form. To do this, you can drag the table from the Controls panel. Similarly, you can select Form/Insert Control from the menu.

The data can be stored in the configuration - then you need to select the existing (previously added) tabular part of the configuration object whose form you are editing.

Click the "..." button in the Data property. In order to see the list of tabular parts, you need to expand the Object branch.

When you select the tabular part, 1C itself will add columns to the table on the form. Rows entered by the user into such a table will be saved automatically along with the reference book/document.

In the same Data property you can enter an arbitrary name and select the Value Table type.

This means that an arbitrary table of values ​​has been selected. It will not automatically add columns, nor will it be automatically saved, but you can do whatever you want with it.

By right-clicking on the table you can add a column. In the properties of a column, you can specify its name (for reference in 1C code), the column heading on the form, the connection with the attribute of the tabular part (the latter - if not an arbitrary table, but a tabular part is selected).

In the table properties on the form, you can specify whether the user can add/delete rows. A more advanced form is the View Only checkbox. These properties are convenient to use for organizing tables intended for displaying information, but not editing.

To manage the table, you need to display a command panel on the form. Select the menu item Form/Insert Control/Command Bar.

In the command bar properties, select the Autofill checkbox so that the buttons on the panel appear automatically.

Table on form (thin/managed client)

On a managed form, these actions look a little different. If you need to place a tabular part on the form, expand the Object branch and drag one of the tabular parts to the left. That's all!

If you need to place a table of values, add a new form attribute and in its properties specify the type – table of values.

To add columns, use the right-click menu on this form attribute, select Add attribute column.

Then also drag the table to the left.

In order for a table to have a command bar, in the table properties, select the values ​​in the Usage – Command bar position section.

Uploading a table to Excel

Any 1C table located on the form can be printed or uploaded to Excel.

To do this, right-click on an empty space in the table and select List.

In a managed (thin) client, similar actions can be performed using the menu item All actions/Display list.