OMRON CHAPTER 12 – Databases
Release 2.0 Page 213
SHAPE {parent-command} [[AS] name]
APPEND ({child-command} [[AS] name] RELATE parent-field TO child-
field)
[,({child2-command} ...)]
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.
Creating a Datashape connection.
♦ Create DSN file specifying the required database as the Data Source
♦ Configure a Connection to the DSN file. In the connection string type
Provider=MSDataShape;
FILEDSN=<your file name>.dsn
♦ Configure a Recordset as SQL Text and enter the required shape command as the Source. (See
Datashape Source examples).
♦ 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
♦ 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: Child recordsets are not supported in the Database function dialog
Simple Relation Hierarchy example:
SHAPE {select * from customers}
APPEND ({select * from orders} AS rsOrders
RELATE customerid TO customerid)
The parent recordset contains all fields from the Customers table and a field called rsOrders.
rsOrders provides a reference to the child recordset, and contains all the fields from the Orders table.
The other examples use a similar notation.