Suppose you have a table of customers named CUST, and a table of their orders named ORDERS. The customers and their orders are both identified by a customer ID field, that happens (by design) to be named CUST_ID in both tables. The following statements create a master-detail link between two queries.

qCust = new Query( )

qCust.sql = "select * from CUST"

qCust.active = true

qOrder = new Query( )

qOrder.sql = "select * from ORDERS where CUST_ID = :CUST_ID order by ORDER_DATE"

qOrder.masterSource = qCust.rowset

qCust.active = true

The parameter CUST_ID in the SQL statement for the ORDERS table is automatically filled in with the CUST_ID field in the CUST table.