Progress
Programming
Handbook


Using Multiple Browse Widgets for Related Tables

This next example shows a multi-table browse (or join) of the order–line and item tables:

p-br15.p
DEFINE QUERY orders FOR order. 
DEFINE BROWSE ord QUERY orders DISPLAY order.cust-num order.order-num  
    WITH 10 DOWN SEPARATORS. 
DEFINE QUERY items FOR order-line, item. 
DEFINE BROWSE itm QUERY items 
    DISPLAY order-line.line-num item.item-name 
    ENABLE item-name 
    WITH 10 DOWN SEPARATORS. 
DEFINE FRAME f1 
  ord space(4) itm 
  WITH NO-BOX SIDE-LABELS ROW 2 CENTERED.ON "VALUE-CHANGED" OF BROWSE ord 
DO: 
    ENABLE itm WITH FRAME f1. 
    OPEN QUERY items FOR EACH order-line OF order, 
        EACH item OF order-line. 
END. 
OPEN QUERY orders FOR EACH order. 
ENABLE ord WITH FRAME f1. 
APPLY "VALUE-CHANGED" TO BROWSE ord.WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW. 

The following is the output of this example:

Each time you select a row in the ord browse, Progress displays the associated order line numbers and item descriptions in the itm browse. The itm browse joins the order–line and item tables.

The APPLY statement causes the order lines for the first order to display before you select a record.

A one-to-one (order–line item) join is best displayed with a single browse widget, because there is a single display line for both tables. In a one-to-many join (order and order–line), it is best to use two separate browse widgets.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095