• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Progress Browse-query help

Hello out there! I'm a bit of a newb in the realm of Progress programming and I have a question regarding the Browse-query functionality. From all the literature I have seen, it appears to me as if the query associated with a browse should only pull from 1 table, meaning that joins in a query are not really allowed. The program I am working with requires that I join multiple table to get all the fields I need to display in my browse. Here is my browse-query code:

open query q-order for each ld_mstr,
each so_mstr where so_mstr.so_nbr = ld_mstr.ldm_ord,
each cm_mstr where cm_mstr.cm_addr = so_mstr.so_cust,
each ccr_default where ccd_param = "CCR_CHEP" and
ccd_value = yes and ccd_cust = cm_mstr.cm_addr.

define browse brw-Order query q-order
with width 75 5 down title "Orders".

Is this correct or is there some other way to do joins in the query definition?
I think I may have figured it out....Is the correct route to create a temp table by doing my search and then to have my browse query use the temp-table for the browse?


ProgressTalk Moderator
Staff member
theres no need to build a temp-table first, not in this case.

queries associated with browsers or not can have multiple ( inner/outer )joins.

/* define the query */

define query qryOrder

    for order, customer, salesrep /* buffers in the query */

        scrolling. /* lets the query move backwards and forwards
                    * theres no need to specify it, it is implicit
                    * for queries used in browsers */

/* define the browse */

define browse brwOrder

    query qryOrder /* in many ways it binds the query to that browse */




    with 10 down width 40.

/* put the browse in a frame (explicitly) */



with frame frmOrder.

/* now that every thing is defined, lets open the query.
 * the entire query is not populated (satisfied)
 * instead the browse only reads the records needed to fill the screen */

open query qryOrder

    /* now this is very important.
     * don't use joins without a matching index ( or indexes that are atleast close enough ) !
     * in that case you will need to create a temp-table first */

    /* make sure your queries are efficient !
     * otherwise you'll endup with some very angry customers */

    for each order no-lock,

        first customer of order no-lock,

        first salesrep of order no-lock

        indexed-reposition. /* useful when jumping over many records e.g. reposition to rowid
                             * try using the "end" key function with or without it
                             * there are trade offs, you might want to read about it first */

enable all with frame frmOrder.

wait-for window-close of current-window.
i highly recommend reading the chapters on queries and browsers in the programming handbook, besides the online f1 help. hth