Use the AVEVA Grid Control with Different Data Sources
- Last UpdatedJan 28, 2025
- 2 minute read
The supplied C# addin populates the grid with database items and their attribute values.
The following data sources are available for this method of working. Refer to Grid Control API for further information.
-
NetDataSource(String TableName, Array Attributes, Array Items)
-
NetDataSource(String TableName, Array Attributes, Array AttributeTitles, Array Items)
-
NetDataSource(String TableName, Array Attributes, Array Items, String Tooltips
There are two other ways that an instance of the grid can be populated with data:
-
Populate the grid with non-database data
The grid can be populated with collections of non-database data.
The following data sources are available for this method of working. Refer to Grid Control API for further information.
-
NetDataSource(String TableName, Array columns, Array of Array of rows)
-
NetDataSource(String TableName, Array columns, Array of Array of rows, String Tooltips)
-
-
Populate the grid with non-database data direct from a Microsoft Excel file.
The grid can be populated with non-database data from a Microsoft Excel file. The first row of the Microsoft Excel file will supply the headings for the grid and the other rows will supply the row data.
The following data source is available for this method of working. Refer to Grid Control API for further information.
-
NetDataSource(String TableName, string PathName)
-
More specific control of grid columns can be made with use of the ColumnSpecifcation class. An array of ColumnSpecifcations can be used in the construction of the NetDataSource.
Examples can be found in the PMLGridExample in the Samples directory.
The Type property can also be set through the ColumnDataType property as a string. It is important to do this before the data is bound to the grid as columnspecifications are read and values are output around that.
-
These can be set to integer, double or string. With string being the default. Units and formats are applied on the string datatype of the column.
-
"real" variables (in pml speak) can be either an integer or a double, however for grid specific properties (sorting, etc.), there is a difference. This is due to the Third Party library being used for grids.
With a dabacon data source for the GridControl, if an expression is used (say SEQU OF OWN), the default grid data type is a string, unless defined otherwise on creation of the columnspecification and the expression returns.
Two new pmlnetcallable constructors have been made for columnspecifications, to correspond with the new settable property.
An example setup in pml would be:
--Create headings with column specifications, this allows for typing
using namespace 'Aveva.Core.Presentation'
nameCol = object COLUMNSPECIFICATION('name', 'name')
!paramCol = object COLUMNSPECIFICATION('despar 1', 'despar 1', 'real')
!seqCol = object COLUMNSPECIFICATION('NUM', 'SEQU')
!sequOwnerCol = object COLUMNSPECIFICATION('NUM OF OWN', 'NUM OF OWN', false, true 'integer')
!headingsColumnSpecified = ARRAY()
!headingsColumnSpecified[1] = !nameCol
!headingsColumnSpecified[2] = !paramCol
!headingsColumnSpecified[3] = !seqCol
!headingsColumnSpecified[4] = !sequOwnerCol