Consultor Eletrônico



Kbase P43494: How to poulate a regular browse from a temp table on the CHOOSE of a button?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   04/05/2011
Status: Verified

GOAL:

4GL/ABL: How to populate a regular static BROWSE from a TEMP-TABLE on the CHOOSE of a BUTTON?

GOAL:

How to use the Freeform Query option of the AppBuilder Query Builder dialog box to define a BROWSE QUERY?

GOAL:

How to use the OPEN_QUERY and the DISPLAY pseudo triggers of a BROWSE when using Freeform Query in the AppBuilder?

FACT(s) (Environment):

Windows
Progress 9.x
OpenEdge 10.x

FIX:

Following is a step by step procedure to populate a one column BROWSE from a TEMP-TABLE populated with the file names of the current directory on the CHOOSE of a BUTTON:

1. Start the AppBuilder.
2. Create new window: File -> New -> Window.
3. Insert the temp table definition in the Definitions section of the Window:

DEFINE TEMP-TABLE ttDirectoryFiles
FIELDS cFileName AS CHARACTER.

4. Drop a BROWSE on the Window connecting to a database when prompted to do so.
5. Choose the 'Freeform Query' option from the Query Builder dialog box.
6. Drop a BUTTON on the window with the following CHOOSE event trigger code:

DO:
DEFINE VARIABLE cCurrentDiretory AS CHARACTER NO-UNDO.
DEFINE VARIABLE cCurrentFileName AS CHARACTER NO-UNDO.

ASSIGN
cCurrentDiretory = "C:\PROGRESS\WRK".
INPUT FROM OS-DIR( cCurrentDiretory).
REPEAT:
IMPORT cCurrentFileName.
IF cCurrentFileName = "." OR cCurrentFileName = ".." THEN
NEXT.
ELSE DO:
CREATE ttDirectoryFiles.
ASSIGN
cFileName = cCurrentFileName.
END. /* ELSE */
END./* REPEAT */
OPEN QUERY BROWSE-1 FOR EACH ttDirectoryFiles.
END.
7. Enter the following code in the OPEN_QUERY pseudo trigger of the browse:

OPEN QUERY BROWSE-1 FOR EACH ttDirectoryFiles.

8. Enter following code in the DISPLAY pseudo trigger of the browse:

cFileName

notice there is no period after the list of the fields to be displayed in the browse.

9. Save the window.

10. Run the window.

11. Click the button to populate the browse.