Sections of the site
Editor's Choice:
- Cloning iPhones: reasons and existing analogues
- How to set and set up a reminder on iPhone How to set a reminder on iPhone 8
- How to enter a military personnel’s personal account without registration - instructions
- Military serviceman's office personal entrance without registration, by personal number
- Personal computer device
- How to turn off the camera on a laptop How to enable or disable voice control history
- How to determine which sound card is installed on your computer
- Blacklist for Android
- How to find drivers for a computer with a custom configuration
- How to completely remove Avast from your computer?
Advertising
1c command form property using the current line. |
How to install a line in 8.2 ( Managed Forms) read . To begin with, I would like to remind you that the data in the tabular part of the document (or table of values) and the tabular field are different objects. In order to do some visual actions, we work with a table field. In this case, we will use its “CurrentRow” property, which is responsible for which row is active. To select the row we need in the table field, we need two steps: 1. Find the row we need in the data object that the table field displays // the second line has an index of one RequiredString = Products; Or we know that in the second line in the Nomenclature column the Code element is “001” then we use the construction: // first find the directory element Nomenclature by code // and then look for it in the “Products” tabular part RequiredLine = Products.Find(Directories.Nomenclature.FindByCode("001")); 2. Set the value of the current line to the found line // if our table field is also called Products Form Elements.Products.CurrentRow = RequiredRow; // if the table field is called TableField1 As a result, the lines of code may look like this: RequiredLine = Products.Find(Directories.Nomenclature.FindByCode("001")); Tabular parts exist for many objects in 1C:
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 partTo 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 partTo 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: To iterate through the selected lines, use a loop 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 themTo 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 How to clear the table partTabularPart. Clear() ; How to get the current row of a table sectionThe current line is the period in which the user has this moment the cursor is located. 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 sectionAdding 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) New line. Props1 = "Value" ; How to programmatically fill in the details of a table rowIf you need to programmatically fill in the details of a table section row that is added by the user, you must use the table section event handler When StartingEditing. The procedure created by the handler has three parameters:
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 the line is new, set the accounting account First you need to understand that there is an object that contains data, for example, Form DataCollection, and there is an object that displays data visually - a Table. There is only the current row in the Table; it cannot be used to find out everything existing values FormDataThe collection with which it is associated. In turn, the FormDataCollection does not have a current row. To connect these objects in 1C, an Identifier is used, because the order of the rows can be changed both in the visual part and in the data, but the connection should not be broken. Let's look at this with an example: The form has a specification of type (Value Table) - in parentheses because the actual type is FormDataCollection The details are displayed on the form in the form of a Table. Defining a Value Table Row by Current Table RowTo determine which row of the TK is currently current, you must first get the row identifier in the Table, and then use it to find the row in the TK RowIdentifier = Elements.TZ.CurrentRow; // Get the identifier in the Table LineTZ = TZ.FindByIdentifier(StringIdentifier); Setting the current row in the TableTo set the current table row you need to do the opposite. First get the TK identifier, and then set the current row of the Table on it. LineTZ = FormDataCollection; // for example, take line 1String Identifier = LineTZ.GetIdentifier(); Elements.TK.CurrentRow = RowIdentifier; For easier understanding, you can download |
Read: |
---|
Popular:
New
- How to set and set up a reminder on iPhone How to set a reminder on iPhone 8
- How to enter a military personnel’s personal account without registration - instructions
- Military serviceman's office personal entrance without registration, by personal number
- Personal computer device
- How to turn off the camera on a laptop How to enable or disable voice control history
- How to determine which sound card is installed on your computer
- Blacklist for Android
- How to find drivers for a computer with a custom configuration
- How to completely remove Avast from your computer?
- Converting GPT to MBR - changing disk layout