Consultor Eletrônico



Kbase P143602: 4GL/ABL: How can I update a LOGICAL TEMP-TABLE field in a BROWSE by clicking on its row?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   25/03/2009
Status: Unverified

GOAL:

4GL/ABL: How can I update a LOGICAL TEMP-TABLE field in a BROWSE by clicking on its row?

GOAL:

How to assign a new value for a field in the BROWSE on the MOUSE-SELECT-CLICK event?

GOAL:

How to update the TEMP-TABLE fields using a BROWSE trigger?

GOAL:

Sample code to create a static BROWSE against a TEMP-TABLE.

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x
OpenEdge Category: Language (4GL/ABL)

FIX:

The following procedure demonstrates how to update a LOGICAL field of a TEMP-TABLE by clicking on its ROW. It shows how to assign a new value for a field in the BROWSE using the MOUSE-SELECT-CLICK event trigger:
/* Define a TEMP-TABLE */
DEFINE TEMP-TABLE ttCustomer NO-UNDO
FIELD ttCustNum AS INTEGER FORMAT "999"
FIELD ttName AS CHARACTER FORMAT "X(30)"
FIELD ttActive AS LOGICAL FORMAT "YES/NO"
INDEX idxNum IS UNIQUE PRIMARY ttCustNum.
/* Populate the TEMP-TABLE */
RUN PopulateTheTempTable.
/* Define the QUERY against the TEMP-TABLE */
DEFINE QUERY qCustomer FOR ttCustomer.
/* Define the BROWSE for the QUERY */
DEFINE BROWSE bCustomer
QUERY qCustomer
DISPLAY ttCustNum ttName ttActive
WITH 5 DOWN MULTIPLE TITLE "Customer Browse".
/* Define the FRAME to for the BROWSE */
DEFINE FRAME fCustomer
bCustomer WITH SIDE-LABELS AT ROW 2 COLUMN 3 OVERLAY .
/* MOUSE-SELECT-CLICK trigger for BROWSE */
ON 'MOUSE-SELECT-CLICK' OF bCustomer
DO:
FIND CURRENT ttCustomer.
IF ttActive THEN
ttActive = FALSE.
ELSE
ttActive = TRUE.
bCustomer:REFRESH() IN FRAME fCustomer.
END.
/* -------------- MAIN --------------- */
MAIN-BLOCK:
DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:
RUN enable_UI.
IF NOT THIS-PROCEDURE:PERSISTENT THEN
WAIT-FOR CLOSE OF THIS-PROCEDURE.
END.
/* --------PROCEDURE enable_UI-------- */
PROCEDURE enable_UI:
VIEW FRAME fCustomer.
OPEN QUERY qCustomer FOR EACH ttCustomer.
ENABLE bCustomer WITH FRAME fCustomer.
END PROCEDURE.
/* -------PopulateTheTempTable------- */
PROCEDURE PopulateTheTempTable:
DEFINE VARIABLE iCounter AS INTEGER NO-UNDO.
DO iCounter = 1 TO 100:
CREATE ttCustomer.
ASSIGN
ttCustNum = iCounter
ttName = "Customer Number " + STRING(iCounter, "99999")
ttActive = IF ttCustNum MODULO 3 = 0 THEN YES ELSE NO.
END.
END PROCEDURE.