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 new document
|
|
|
Open 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 doesn’t matter what this moment 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 asking you 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 selected so that it is easy to press 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, return what you did before pressing undo on the last action you took.
|
|
|
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 positioned)
|
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 system menu 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 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 open form activate default button
|
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 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
|
A new group
|
|
Creates new group. Similar to the "Add group" button
|
Delete a line
|
|
Directly delete the current element. Attention! Use this combination with extreme caution in dynamic lists, since 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
Entry 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
|
|
Mouse clicking 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 grouped hotkeys for various 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
Hotkeys 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 text
|
|
Highlights text page by page
|
Select next page text
|
Shift + Page Down
|
Remove selection
|
|
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
|
|
Shifts the selected block of text to the left
|
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 line if selection is imposed on tabular part🙂 but for users this limitation looks rather artificial (incomprehensible, “far-fetched”).
A slightly more complex solution is to call the Reset() method on the RowSelection collection on the table field (associated with tabular 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 table section”) soft reset 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();
EndProcedure
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; locSelectionStructure1.Clear();
EndProcedure
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).
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? ![](https://i2.wp.com/sbp-program.ru/sbp-1c/v80pattern/Svertka.jpg)
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: Procedure CommandPanel1Print(Button) variable td, rs, rs1, layout, code, name, nomen;
code = 0;
layout = GetLayout("Products");
header = layout.GetArea("Header");
header.Parameters.datta = CurrentDate(); pc = layout.GetArea("pc");
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 = selection.Name;
td.Output(rs1); else rs.Parameters.code = code; rs.Parameters.name = selection.Name; td.Withdraw(rs);.
endIf;
endCycle;
If you use the 1C line formed this way as usual, then it will be what is written in it. In order for the system to split it into two options and use the desired one, you need to use the НStr() function: //correct for bilingual configurations Report(NStr(Variable));
Props with line type 1C
The attribute is a field in the 1C directory/document. It differs from a variable in a program in the 1C language in that for the attribute its type is precisely indicated (number, 1C string, etc.). If you need to refresh your memory of what a prop is, watch the lesson on.
If you specify the type of attribute - line 1C, then you must additionally specify the parameters.
1C lines come in unlimited length (indicated as length = 0) and limited length, indicating the exact number of characters. 1C lines of unlimited length are stored in a separate SQL table, so their use is less productive than limited.
That is why the use of 1C strings of unlimited length has its limitations - it is not possible to use them everywhere. For example, it is not allowed as a document number, reference code, or measurement.
Working with 1C strings
There are several built-in functions of the 1C platform for working with strings.
- AbbrLP (“Incredible, but true!”)
Removes extra spaces from the 1C line. Can also be used to convert any types to a 1C string (for example, numbers).
- Variable = "Vasya" + AbbrLP(" plus") + "Olya"; //there will be "Vasya plus Olya"
An example of summing several 1C string values. The result will be one line 1C.
- Variable = Lev("Music", 2); //will be "Mu"
Variable = Medium("Music", 2, 2); //there will be "threat" Variable = Rights("Music", 2); //there will be "ka" Various options for obtaining a substring from a 1C string.
- Variable = Find("Music", "zy"); //there will be 3
Search for a substring in string 1C, starting with character 1.
- Variable = StrLength("Music"); //there will be 6
Returns the number of characters in the 1C line.
- Report("Hello") //in the message window at the bottom of the 1C window
Alert("Hello") //popup dialog Status("Hello") //in the status display line at the bottom left .
Bringing objects to line 1C
As you know, the most popular format for exchanging structured information at present is XML. Even latest version MS Office Word and Excel save files in this format (docx and xlsx, respectively, change the extension to zip, open in an archiver).
The 1C platform for data exchange provides several options, the main one of which is also XML.
1. The simplest method is to use the Abbreviation() or String() function. You can use the REPRESENTATION() function in the request body. The result of their action is the same - they generate a string representation of any 1C object for the user.
For a directory by default, this will be its name. For a document – document name, number and date.
2. Any 1C object (with restrictions) can be converted to XML and vice versa. The conversion process is called serialization. StringViewXml = XMLString(Value); //get XML from 1C value Value1C = XMLValue(Type("DirectoryLink.Nomenclature"),TypeStringXml); //get the 1C value from the XML string, you must specify the 1C type that should be received
3. There is the 1C platform’s own way to convert any 1C object into a string. It migrated from version 1C 7.7. This format is not understood by other programs, but other 1C understands it, which makes it easy to use it for exchange between 1C databases. Row = ValueInRowInt(Value1C); //get string 1C from value 1C ValueVFile("C:\MyFile.txt", Value1C); //another option, we get a file with a saved string from the 1C value Value1C = ValueFromStringInt(String); //back from line 1C Value1C = ValueFile("C:\MyFile.txt"); //back from file
Editing 1C lines on the form
In addition to working with 1C strings in a program in the 1C language, of course I would like the user to be able to edit them. There are several possibilities for this:
1. The easiest way is to request the entry of a 1C line on demand. This method is used when teaching 1C programming; in life it is used much less often (but it is used!). Variable = ""; Row = EnterValue(Variable, "Enter Full Name");
2. To display the details of a 1C object (directory/document) or form details (see), an input field is most often used. This is the most common tool in 1C for the user to work with editing fields.
![](https://i1.wp.com/howknow1c.ru/pline/stroka-1s/2.stroka-1s-na-forme.png)
3. The capabilities of the input field can be expanded (see properties of the input field, right-click on it, more details):
- Checkbox Multiline editing mode
- Advanced editing checkbox (available if the previous checkbox is checked)
- Checkbox Password mode (see).
![](https://i2.wp.com/howknow1c.ru/pline/stroka-1s/3.svojstva-stroki-1s.png)
4. If all the capabilities of the input field are not enough for you, there is a built-in editor. To add it to the form, you need to add Field to the Form/Insert control menu text document. In its properties you can specify its operating mode – the Extension property.
![](https://i2.wp.com/howknow1c.ru/pline/stroka-1s/4.jelement-upravlenija-1s.png)
A text document field cannot be associated directly with data. It is necessary to write a function in the OnOpen() event handler of the form (see): Form Elements.ElementNameTextDocumentField.SetText(StringValue); //here ValueString is the text received, for example, from the attribute
And in the save handler - for example, in the Save button - add a save: ValueString = FormElements.ElementNameTextDocumentField.GetText(); //ValueThe line here is the attribute where we save the value
5. In 1C version 8.2.11, in controlled forms, appeared new opportunity 1C line representation – Formatted document field.
![](https://i0.wp.com/howknow1c.ru/pline/stroka-1s/5.formatirovannyj-dokument-1s.png) Similar to the field of a text document, you must set it when opening it and write it down when saving it yourself using the program.
- In the 1C object whose form we are creating (directory, document, processing, etc.) - add an attribute with the Value Storage type
- In the OnReadOnServer() function we set the text from the attribute
//here the Attribute is the added attribute of the 1C object //here FormattedDocument is the name of the field on the form for editing &On server
FormattedDocument = CurrentObject.Attributes.Get(); EndProcedure
- In the BeforeWritingOnServer() function or using the button, we will write the text from the field
&On server Procedure When ReadingOnServer(CurrentObject) CurrentObject.Props = NewValueStorage(FormattedDocument); EndProcedure
Tabular parts exist for many objects in 1C:
- Directories
- Documentation
- 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 each
For each Row from the Tabular Part of the Cycle Report(String. TabularPart attribute) ; 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 the 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:
A loop is used to iterate through the selected lines. For each:
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 part:
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. New line. 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 TableField.
- New line- boolean. Contains value True, if added new line tabular part, 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; EndProcedure
|