Progress
Programming
Handbook


Differences Between Temporary and Work Tables

Temporary tables and work tables have the following differences:

The following program illustrates using a temporary table for non-database data:

p-ttnodb.p
/* p-ttnodb.p - static temp-table with no database */
DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE btth AS HANDLE.
DEFINE VARIABLE browseHndl AS WIDGET-HANDLE.
DEFINE TEMP-TABLE t-field NO-UNDO
   FIELD fInt AS INTEGER
   FIELD fChar AS CHARACTER
   FIELD fDec AS DECIMAL
   FIELD fLog AS LOGICAL.

DO i=1 TO 10:
    CREATE t-field.
    ASSIGN fInt = i
           fChar = "char" + STRING(i)
           fDec = i
           fLog = NO.
END.

DEFINE QUERY qt-field FOR t-field SCROLLING.
OPEN QUERY qt-field FOR EACH t-field.
btth = BUFFER t-field:HANDLE.
DEFINE FRAME F1
    WITH SIZE 82 BY 29 .

CREATE BROWSE browseHndl
    ASSIGN
        FRAME = FRAME F1:HANDLE
        X = 2
        Y = 2
        WIDTH = 80
        DOWN = 18
        TITLE =  "Temp Table is not based on DB table"
        QUERY = QUERY qt-field:HANDLE
        SENSITIVE = YES
        VISIBLE = TRUE
        READ-ONLY = FALSE
        SEPARATORS = YES.
browseHndl:ADD-COLUMNS-FROM(btth).

ENABLE ALL WITH FRAME F1.
WAIT-FOR CLOSE OF CURRENT-WINDOW. 


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