Datashaping
SECTION 12 Databases
197
12-9
Datashaping
The ADO SHAPE command can be used to produce hierarchical recordsets
i.e. where a value within the current record is used to access another
Recordset. For example, a record showing Customer Details might contain a
field for Customer ID. Every time the record position is changed, a child
Recordset showing Orders for that Customer ID could be recreated.
Hierarchical recordsets present an alternative to using JOIN syntax when
accessing parent-child data. Hierarchical recordsets differ from a JOIN in that
with a JOIN, both the parent table fields and child table fields are represented
in the same recordset. With a hierarchical recordset, the recordset contains
only fields from the parent table. In addition, the recordset contains an extra
field that represents the related child data, which you can assign to a second
recordset variable and traverse.
Hierarchical recordsets are made available via the MSDataShape provider,
which is implemented by the client cursor engine.
A new clause, SHAPE, is provided to relate SELECT statements in a
hierarchical fashion. The syntax is summarized below:
SHAPE {parent-command} [[AS] name]
APPEND ({child-command} [[AS] name] RELATE parent-
field TO child-field)
[,({child2-command} …)]
Creating a Datashape
connection.
1. Create DSN file specifying the required database as the Data Source
2. Configure a Connection to the DSN file. In the connection string type
Provider=MSDataShape;
FILEDSN=<your file name>.dsn
3. Configure a Recordset as SQL Text and enter the required shape
command as the Source. (See Datashape Source examples).
4. After successfully adding a Datashape Recordset it is now possible to add
a Child Recordset to the existing Recordset by selecting the right menu
option 'Add Recordset' which will now be enabled. If the Connection is
'Live' a list of valid child recordset names will be entered in the Source
ComboBox
5. Field associations can be added to Child recordsets in the normal manner.
Child recordsets can be accessed via Script command in a similar manner
to normal recordsets
bResult = DBState(
"DataShape.Customers.Orders.Details", "Open" )
Note:
By default, the child recordsets in the parent recordset will be called Chapter 1,
Chapter 2, etc., unless you use the optional [[AS] name] clause to name the
child recordset.
Note:
You can nest the SHAPE command. The {parent-command} and/or {child-
command} can contain another SHAPE statement.
Note:
The {parent-command} and {child-command} do not have to be SQL SELECT
statements. They can use whatever syntax is supported by data provider.
Note:
A child recordset will be automatically opened/closed whenever its Parent
recordset is opened/closed. A child recordset is effectively a field of its parent
recordset therefore whenever a new record is selected in the parent a new
child recordset will be generated.
Note:
Child recordsets are not supported in the Database function dialog box
Summary of Contents for CX-Supervisor
Page 1: ...CX Supervisor Software Cat No W10E EN 01 User Manual Software Release 3 1...
Page 3: ...Copyright Notice 2...
Page 16: ...15...
Page 17: ...16...
Page 27: ...Tip of the Day SECTION 1 Graphics Editor 26...
Page 35: ...CX Supervisor Preferences SECTION 2 Pages 34...
Page 79: ...Responding to Events SECTION 5 ActiveX Objects 78...
Page 115: ...Printing the Graphics Library SECTION 7 Graphics Library 114...
Page 181: ...Data Logging SECTION 11 Data Logging 180...
Page 201: ...Examples SECTION 12 Databases 200...
Page 243: ...Performance Monitor SECTION 16 Application Analysis Performance Monitor 242...
Page 253: ...Using with Omron s CX Server OPC SECTION 17 Using CX Supervisor as an OPC Cli 252...
Page 259: ...Creating a CX Supervisor Client application SECTION 18 Connecting to a remote CX 258...
Page 263: ...Adding a Point Linked to a Parameter SECTION 19 Connecting to Omron Industrial 262...
Page 271: ...Data Logging SECTION 20 Best Practices 270...
Page 275: ...Configuring a Server PC running Windows NT or 2000 Appendix A Configuring a PC 274...
Page 277: ...Appendix B Frequently Asked Questions 276...
Page 296: ...Appendix B Frequently Asked Questions 295...
Page 297: ...Appendix B Frequently Asked Questions 296...
Page 298: ...Appendix B Frequently Asked Questions 297...
Page 299: ...Appendix B Frequently Asked Questions 298...
Page 333: ...Revision history 332...