Views Definition Object |
|
The views definition object, ViewCtl, can be used to create, update and delete data sources, views and data groups. It provides the same functionality programmatically that is available via Data Source Maintenance and View Maintenance.
This object (*views/viewctl.pvc) embodies the entire view definition and can be created from the beginning or loaded from the definition stored in the view definition files, updated and then saved back into the definition files.
ViewCtlis created by the following command:
ObjID = NEW ("*views/viewctl [,ViewsDirectory$], ERR=stmtref)
Structural Overview
The main ViewCtl object delegates functionality to subordinate objects for dealing with individual view, data source and data group definitions. These objects will in turn delegate functionality to another level of subordinates for dealing with calculated items, views items, data source items, and relationships.
Subordinate objects to ViewCtl include ViewDef, CalcItem, ViewItem, DataGroup, DataSource, DS_Item and DS_Link.
The structure of the views definition object is depicted in the following chart:
ViewCtl creates a group of ViewDef objects to hold view information (one per view). More than one view can be maintained using this method. Each ViewDef object creates a group of CalcItem objects to define calculated expressions that are available to the view (one object per item), as well as ViewItem objects to define the selected items within the view (one object per item).
DataSource objects are created to hold the definition of the primary data source of each view, as well as the definitions for related (or linked) data sources used by the views. Each DataSource object will in turn create a group of DS_Item objects (one for each defined element in the data source) and a group of DS_Link objects to define the parent-child relationships that exist for the data source.
Finally, a group of DataGroup objects will define to which data groups the views and their data sources are assigned (one object per data group). Object groups are created using the *obj/group utility that defines lists of related objects.
For a detailed list of the different components within the views definition structure, see ViewCtl Properties and ViewCtl Methods, as well as its Subordinate Objects. In each of these, assume that the Add xxx( ) and Load xxx( ) methods return the object identifier of the object that has been added or loaded successfully, or 0 (zero) if not. All other methods return values of 1 (success) and 0 (failure), unless otherwise indicated.