Promotic

DtiOper - Interface description

DtiOper is an interface for table viewing and editing of various data sources.

Basic description

The DtiOper concept consists of the table viewer (PmaPanel with PmgWTable) and data source (objects PmaAdo, PmaDataTable, etc.). The viewer communicates with the data source by designer's "DtiOper" method representing the data source. The method includes individual valid operations provided by the data source to the viewer. In the sDtiPars parameter of the "DtiOper" method, there is complete information needed for the data source in the KeyVal format, converted for better convenience into map mDtiPars at the beginning of each operation. The other parameters of the method specify additional details of the requested operation. This concept is very general and allows viewing of a data source by multiple viewers simultaneously, including Web viewing. The data source of the PmaAdo object represents data source for all database tables of the database, so simultaneous viewing of a single data source is a must. Also the future addition of new "operations" (basic and user defined) is easy this way, simply to call the "DtiOper" method (in the viewer) with the new operation that is implemented in corresponding data source.

Table viewer

The viewer is general, parametrized by a single, structured parameter DtiPars. The parameter represents a specific data source including the parameters of the corresponding viewer. Can be used a single viewer for viewing various data sources with corresponding value of the DtiPars parameter. More practical and clearer approach is to use a specific individual viewer for each data source, which allows to define the viewing parameters as a confiuration directly in the viewer. This way it is also easier to customize the viewer for specific purposes.

DtiPars in the KeyVal format is the key component of the DtiOper concept. It must contain all the necessary information needed for the first opening of the viewer. DtiPars can initially be provided filled with complete information, or partially filled, or modified in following steps:
 
Passing the DtiPars string to the viewer. The parameter will contain: path to data source, table name and header of the table.
 
1) Viewer panel DtiPars parameter provided in sParams in the Pm.CreateView method, or in the configurator of the PmaWorkspace object of the Params default value frame.
Example: pars:{DtiPars:{DtiPath:../PmaAdo;Table:MyTable;Title:Table overview of values}}
Example: Passing the DtiPars string to the viewer.
2) Viewer panel DtiPars parameter provided in the "sViewPars default value" configurator.
Example: pars:{DtiPars:{DtiPath:../PmaAdo;Table:MyTable;Title:Table overview of values}}
3) In the initial value of the DtiPars parameter, as defined in parameters Pmg object parameters PmgRoot of the viewer.
Example: DtiPars:DtiPath:../PmaAdo;Table:MyTable;Title:Table overview of values
4) In the "Open" method of the viewer that takes the value of the DtiPars parameter and calls the operation "Open". Up to here, it is just passing the panel parameter DtiPars.
Example: Modification of the 1st and 2nd row of the "Open" method of the PmgWTable object
Example: Insert of 3rd to 5th row into the Open method of the PmgWTable object
5) In the "Open" operation of the data source the information regarding the data source provided in sDtiPars is processed. The validity is verified and the information necessary for further operations is added thus creating new completed sDtiPars.
6) In the "Open" method of the viewer that takes the result of the "Open" operation in the form of DtiPars. It takes the values intended purely for the viewer and then deletes them from DtiPars while keeping only the values necessary for the data source. The new resulting DtiPars with information for the data source then remembers all the following operations.

Description of preset values in DtiPars

Values in DtiPars (these may slightly differ based on the data source):

DtiPath: Path to data source (any PmaObject with DtiOper method) may also be relative to PmaPanel with the viewer.
The value je mandatory. The value is remembered by the viewer and then it is removed from DtiPars.
Table: Table name.
if the data source contains multiple tables then the value je mandatory, otherwise the value je optional.
In the PmaAdo object there is the name of the database table and it is not mentioned in the PmaDataTable object.
ColNames: List of column names for displaying.
The value je optional. If not defined then all columns of the data source are viewed.
ColPkNames: List of column names with primary key (specifies the uniqueness of the record for editing or deleting).
The value je optional. If not defined then only the first column is used.
ColPkCount: Number of columns with primary key (specifies the uniqueness of the record for editing or deleting).
The value je optional. If not defined then only the first column is used.
ColTypes: List of column data types (for displaying and generating SQL statements).
The value je optional. If not defined then provided by autodetection.
ColPkTypes: List of column data types with primary key (for displaying and generating SQL statements).
The value je optional. If not defined then provided by autodetection.
ColTitles: List of column headers for displaying (e.g. localized text).
The value je optional. If not defined then the ColNames is used.
The value is remembered by the viewer and removes it from DtiPars.
Title: Header of viewed table (e.g. localized text).
The value je optional. If not defined then the Table is used or it stays empty.
The value is remembered by the viewer and removes it from DtiPars.

DtiOper data source method operation (sOper parameter)

"Open": It is called just once as a first operation while opening the viewer. The main task of the operation is to take the initial value of sDtiPars and verify correctness. Then it adds the missing information for the viewer and for the following operations over the data source. The result of such operation is a new completed value of DtiPars that will be returned to the viewer. The viewer remembers this modified DtiPars and then it passes it in the sDtiPars parameter to each following operation over the data source. Column names, column titles, column data types, list of primary keys, etc. are added to DtiPars. The data source itself can save own necessary information for following operations. Some values in DtiPars are used only for initial displaying of the viewer. These values are then removed DtiPars for optimalization, so the DtiPars is not too big and contains only information necessary for data sources.
The operation returns DtiPars in the KeyVal format.
"Close": It is called just once as a last operation while the viewer is closing. This operation is not even implemented usually.
"GetRows": It is called repeatedly each time the viewer needs to refresh its content.
The operation returns 2-dimensional array of values.
"AddRow": vPar1 = array of all values of the added row. It is called when a single row is added.
The operation returns 1 = OK, 0 = error
"EditRow": vPar1 = array of all values of the edited row, vPar2 = array of values that identify the edited row (values of primary key) It is called when a single row is edited.
The operation returns 1 = OK, 0 = error
"DeleteRow": where vPar1 = array of values that identify the deleted row (values of primary key) It is called when a single row is deleted.
The operation returns 1 = OK, 0 = error
Passing the DtiPars string to the viewer.:
The parameter will contain: path to data source, table name and header of the table.
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(null, "../ViewerDataTable", "pars:{DtiPars:{DtiPath:../PmaAdo;Table:MyTable;Title:Table overview of values}}", "target:_blank;");
oCreator.Open();
Modification of the 1st and 2nd row of the "Open" method of the PmgWTable object:
This modification allows to place multiple tables connected to various data sources into a single panel (various tables of a single database or multiple databases).
JavaScriptSelect and copy to clipboard

var sDtiPars = "DtiPath:../PmaAdo;Table:MyTable;Title:Table overview of values";
// var sDtiPars = pMe.GetPar("DtiPars");
or
Insert of 3rd to 5th row into the Open method of the PmgWTable object:
JavaScriptSelect and copy to clipboard

mDtiPars.DtiPath = "../PmaAdo";
mDtiPars.Table = "MyTable";
mDtiPars.Title = "Table overview of values";

History:
Pm9.00.01: Created
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
 
- DtiOper
 
 
- SVG
© MICROSYS, spol. s r.o.