Promotic
WikipediaLinkedInYoutubeTwitterFacebook

DtiOper - Interface description

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

Basic description

The DtiOper concept consists of a table viewer (PmaPanel with PmgWTable) and data source (PmaAdo, PmaDataTable, etc.). The viewer communicates with the data source by DtiOper method representing the data source. The method includes individual valid operations provided by the data source to the viewer. In parameter sDtiPars of the DtiOper method, there is complete information needed for the data source in the form of KeyVal, 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, 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 by calling 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. It is possible to use a single viewer for viewing various data sources with corresponding value of 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 form of KeyVal 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 displayed table.
 
1) Viewer panel parameter DtiPars provided in sParams in the OpenView method, or in PmaWorkspace configurator 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 parameter DtiPars provided in the "sParams 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 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 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: Insertion 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 is 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 is mandatory, otherwise the value is not mandatory.

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 viewing.

The value is not mandatory. If not defined then all columns of the data source are viewed.

ColPkNames: List of column names with primary key (defines the uniqueness of the record for editing od deleting).

The value is not mandatory. If not defined then only the first column is used.

ColPkCount: Number of columns with primary key (defines the uniqueness of the record for editing od deleting).

The value is not mandatory. If not defined then only the first column is used.

ColTypes: List of column data types (for viewing and generating SQL commands).

The value is not mandatory. If not defined then provided by autodetection.

ColPkTypes: List of column data types with primary key (for viewing and generating SQL commands).

The value is not mandatory. If not defined then provided by autodetection.

ColTitles: List of column headers for viewing (e.g. localized).

The value is 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).

The value is not mandatory. 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 sDtiPars parameter to each following operation over the data source. Column names, column titles, column data types, 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 form of KeyVal.

"Close": It is called just once as a last operation while the viewer is closing. This operation is not even implemented in most cases.
"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 displayed table.
JavaScriptVBScriptSelect and copy to clipboard

pMe.PmPanel.OpenView("../ViewerDataTable", "target:_blank;", "pars:{DtiPars:{DtiPath:../PmaAdo;Table:MyTable;Title:Table overview of values}}");
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
Insertion 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: New interface allowing table viewing of data source
PROMOTIC 9.0.7 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
 
- DtiOper
 
 
- SVG
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice