Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Item - property of object PmDataTable

Description:
The property returns (sets) the value of the table cell.
Syntax:
Item(Row As Variant, Col As Variant) As Variant
Calling:
Reading the value:
val = oDataTable.Item(row,col)
Writing the value:
oDataTable.Item(row,col) = val
Parameters:
Row(Variant) Specification of the cell row in the table either by the index (Long or Integer data type) or by the row identifikator (String data type, case sensitive text).
If the value is >=0 then it is the row index (zero-based index).
The value -2 means the last row.
The value -3 sets the value in all rows of the selected column.
 
Caution! Row identifier can be used only if the first column of the table is of the data type Identifier.
Col(Variant) Specification of the cell column in the table either by the index (Long or Integer data type) or by the name (String data type, case sensitive text).
If the value of the index >=0 then it is the column index (zero-based index).
The value -2 means the last column.
The value -3 sets the value in all columns of the selected row.
Note:
Property access for read and write.

The value of this property can be also obtained in the INFO system in "PmRoot" item (when looking into the object with this property). This property can be changed in the INFO system by clicking the "Actions" button. See permission PmRoot > Permissions > InfoEdit.

 
"Read only" columns: Each cell is empty at the beginning. The cell is considered empty also if it contains numeric value 0 or an emty string "". New value can be written into such cell. After writing a non-zero value into the "Read only" column the cell is "locked". "Locked cell" becomes a constant and cannot be written again. Other still "unlocked" cells can be written into as needed. Methods that write into multiple cells simultaneously will write the values only into "unlocked cells" while the content of "locked" cells remains unchanged.
Example1:
In the "/Data/Params" object (of the PmDataTable type) the following operations are carried out:
- the value 3.14 is set into the 1.row and 1.column
- the value 1 is added to the 1.row and the last column
- the whole 8.column is zeroized
Dim oDataTable
Set oDataTable = pMe.Pm("/Data/Params1")
oDataTable(0,0) = 3.14
oDataTable(0,-1) = oDataTable(0,-1) + 1
oDataTable(-3,7) = 0
Example2:
Reading value from table cell from row index 0 and column index 0 into variable v1 and reading value from cell located on row named temperature and in column named value into variable v1.
Dim oDataTable, v1, v2
Set oDataTable = pMe.Pm("/Data/Params1")
v1 = oDataTable(0,0)
v2 = oDataTable("temperature", "value")
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice