UDB Rowset object
This article is about the Rowset object in the UDB object model. This model is for data exchange between USoft web UIs and Rules Engines. This model is built around the udb, DataSourceContainer, Rowset, Rows, and Cols object types. See also UDB events.
A Rowset object, defined by the UdbRowSets class, contains a collection of one or more row set objects (UdbRowSet class), identifying them with so-called keys strings containing key values (if any) that these row sets refer to. A UdbRowSets object containing multiple row sets comes into play when you offer multiple controls based on the same data in the same interface.
Current row set
To refer to the currently selected row set, you can use 'current' as a value when invoking the Rowset object.
Example
This example returns the keys string of the current PERSON record:
$.udb('PERSON').rowSet('current').keysString();
Main row set
When referring to the 'main' row set, e.g. when querying a data source that has no related parent data sources, the row set is empty, represented by an empty keys string '', see below.
Keys string
A UdbRowSet object may simply refer to the main collection of records of a data source, in which case its keys string will be equal to '' (the empty string).
It may also refer to a set of records linked to a record of another data source, most commonly to a parent record connected to the row set by a parent-child relation established through a Relate control object of a data source. The row set's keys string is composed in this case of all the parent records the row set is linked to, although most commonly this is a single parent data source and a single parent record in that data source.
You can call:
- .keysString() (Example 1 below) to get the keys string as a string.
- .keyValues() (Example 2 below) to get the keys string as an object.
Notably, the row's key string for each of the parent data sources together will make up the entire keys string for the child's UdbRowSet object.
Example 1
This example returns a keys string as an object. This keys string identifies the parent keys of a TOUR record referenced by the current row set of the SCHEDTOUR child table. In this case, the key spans two columns:
$.udb('SCHEDTOUR').rowSet('current').keyValues();
Example result:
{ '1.DS59': { '$60': 'AUSTRALIA', '$61': 'ISLAND SUNTANNER' } }
Example 2
This example is the same as Example 1, but the return value is a string instead of an object:
$.udb('SCHEDTOUR').rowSet('current').keysString();
Example result:
'1.DS59=$60:AUSTRALIA;$61:ISLAND_SUNTANNER'