Examples; Simple Relation Hierarchy Example; Compound Relation Hierarchy Example; Hierarchy With Aggregate Example - Omron CX-Supervisor User Manual

Hide thumbs Also See for CX-Supervisor:
Table of Contents

Advertisement

Examples

12-10 Examples

12-10-1 Simple Relation Hierarchy example:

12-10-2 Compound Relation Hierarchy example:

12-10-3 Hierarchy with Aggregate example:

12-10-4 Group Hierarchy example:

12-10-5 Group Hierarchy with Aggregate example:

198
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.
This sample illustrates a three-level hierarchy of customers, orders, and order
details:
SHAPE {SELECT * from customers}
APPEND ((SHAPE {select * from orders}
APPEND
({select
rsDetails
RELATE orderid TO orderid)) AS rsOrders
RELATE customerid TO customerid)
In addition to the Simple Relation Hierarchy example, the Order ID is now
used to create a recordset containing the order details for the shown order.
SHAPE (select * from orders}
APPEND ({select od.orderid, od.UnitPrice * od.quantity
as ExtendedPrice
from [order details] As od}
RELATE orderid TO orderid) As rsDetails,
SUM(ExtendedPrice) AS OrderTotal
This example creates a Recordset of all the orders and their details, and adds
a field called ExtendedPrice to store the total order value for each record, and
sums all the ExtendedPrice values which is stored in Order Total.
SHAPE
{select
orders.*
from
customers
customers.customerid =
orders.customerid} AS rsOrders
COMPUTE rsOrders BY cust_id
SHAPE
SHAPE
orders.orderdate fromc ustomers inner join orders
on customers.customerid = orders.customerid}
APPEND
od.quantity as ExtendedPrice from order details]as
od} AS rsDetails
RELATE orderid TO orderid),
SUM(rsDetails.ExtendedPrice)
rsOrders
*
from
customers.customerid
inner
{select
customers.*,
({select
od.orderid,od.unitprice
SECTION 12 Databases
[order
details]}
AS
cust_id,
join
orders
orders.orderid,
AS
OrderTotal)
AS
on
*
AS

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-supervisor 3.1

Table of Contents