Consultor Eletrônico



Kbase 13390: Browser using temp table to obtain unique records
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   15/10/2008
Status: Verified

GOAL:

How to use a browser with a temp table to obtain unique records.

FIX:

In order to obtain ONLY unique records in the browser, you need to define a temp table to hold the unique records and then define the browser against the temp table.

Example:

DEFINE TEMP-TABLE tcust
FIELD name LIKE customer.name.

FOR EACH customer BREAK BY name:
IF FIRST-OF(name) THEN
DO:
    CREATE tcust.
ASSIGN tcust.name = customer.name.
END.
END.

DEFINE QUERY custq FOR tcust.
DEFINE BROWSE custb QUERY custq
DISPLAY tcust.name WITH 5 DOWN TITLE "Unique Name Browser".

FORM
custb
  WITH FRAME x.

OPEN QUERY custq FOR EACH tcust.
ENABLE custb WITH FRAME x.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.