Developer Documentation Library > Data Model > UNICOM Intelligence Data Model reference > Table Services DSC
 
Table Services DSC
The Table Services DSC is a case data source component (CDSC) that provides the following features for other UNICOM Intelligence or third-party CDSCs:
An HDATA (hierarchical) view of the data for a CDSC that supports only a VDATA (flat) view. The HDATA view can be used only for reading data.
A VDATA view of the data for a CDSC that supports only an HDATA view. The VDATA view can be used for reading, inserting, updating, and deleting data.
When required, the Table Services DSC is invoked automatically by the and other UNICOM Intelligence components, such as the Weight Component, the SQL Aggregator, and the Table Aggregator, and functions as a wrapper around the underlying CDSC. For example, if you connect to a data source using the Quantum DSC (mrPunchDsc), which supports only a VDATA view, and execute the query SELECT * FROM vdata, the will use mrPunchDsc directly. However, if you execute the query SELECT * FROM hdata, the will automatically invoke the Table Services DSC to wrap around mrPunchDsc and generate an HDATA view.
The Table Services DSC allows other DSCs that support only a VDATA view to be treated as hierarchical in UNICOM Intelligence Reporter. See Supported data formats.
It is not possible to use the Table Services DSC to connect to data sources directly.
Generating the alternative views
The Table Services DSC is invoked only when the connection to the data source includes a metadata source in the form of a UNICOM Intelligence Metadata Document (.mdd) file or any other format for which a suitable read-enabled MDSC is available.
When an HDATA view is required for an underlying CDSC that has provided only a VDATA view, the Table Services DSC examines the metadata's Fields collection and generates a child table for each mtGrid object or each mtArray object whose Type property is set to mlExpand. (Both of these objects are known as "bounded" or "expanded" loops.) Each iteration of the loop is represented by one row in the child table. All other objects in the Fields collection are included in the HDATA table generated by the Table Services DSC. However, mtArray objects whose Type property is set to mlLevel (or "unbounded" loops) are ignored by the Table Services DSC.
When a VDATA view is required for an underlying CDSC that has provided only an HDATA view, the Table Services DSC generates a VDATA table that includes one column for each object in the metadata's Variables collection. The Variables collection includes expanded loops, but not unbounded loops, hence the VDATA view generated by the Table Services DSC will not include unbounded loops.
Because the Table Services DSC is invoked only when an alternative view is needed to allow the execution of a query, the alternative view is not included in the schema displayed in tools such as DM Query that can display the schema for the input data source.
Using the alternative view to insert, update, or delete data
As long as the underlying CDSC supports adding, updating, and deleting records, client applications can insert rows into a VDATA table generated by the Table Services DSC, or update or delete existing rows in that table. If an insert or update statement refers to a VDATA column that corresponds to a column in a child (lower-level) table in the underlying CDSC, the Table Services DSC will modify the data in that child table. If a row is deleted from the VDATA table, the Table Services DSC deletes the corresponding row from the underlying CDSC's top-level table and lets the underlying CDSC delete any related rows from its child tables.
HDATA tables generated by the Table Services DSC are read-only.
Generating the alternative view for a dew data source
If the connection is to a new data source, the client application must create a virtual table that can be used to write data to the CDSC. There are two main ways of doing this:
Executing a CREATE TABLE statement against the CDSC.
Executing the extended stored procedure (see Adding extended stored procedures) against the CDSC.
When a CREATE TABLE statement is executed, the checks the CDSC's property mao (see CDSC interface to see whether it supports an HDATA view, a VDATA view, or both. If the statement is CREATE TABLE vdata, and the CDSC supports only an HDATA view, the invokes the Table Services DSC to create a top-level table in the CDSC and generate a VDATA view of the data.
When the xp_syncdb extended stored procedure is executed, and the CDSC's property map shows that it supports only an HDATA view, xp_syncdb invokes the Table Services DSC to create top-level and child tables in the CDSC (by referring to the supplied metadata document's Fields collection) and generate a VDATA view of the data.
After the VDATA table has been generated by the Table Services DSC, the client application can insert data into that table.
Summary of features
The Table Services DSC provides an HDATA view for the following UNICOM Intelligence CDSCs and any read-enabled, third-party CDSC that supports only a VDATA view. The HDATA view is read-only:
SPSS Statistics SAV DSC
Quantum DSC
QDI/DRS DSC
Log DSC
ADO DSC
Delimited Text DSC
The Table Services DSC provides a VDATA view for the following UNICOM Intelligence CDSC and any read-enabled, third-party CDSC that supports only an HDATA view. In addition to reading data, the VDATA view can be used for creating tables and inserting, updating, and deleting data if the CDSC supports those features:
UNICOM Intelligence Data File CDSC
The internal name of the Table Services DSC is mrHVDataDsc.
See also
Table Services DSC error and warning messages
Available DSCs
UNICOM Intelligence Data Model reference