Kbase P154285: Sample code to demonstrate a Search field for a Browse
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  13/10/2009 |
|
Status: Unverified
GOAL:
Sample code to demonstrate a Search field for a Browse
GOAL:
How to create a search field to reposition in a Browse
FACT(s) (Environment):
All Supported Operating Systems
Progress 7.x
Progress 8.x
Progress 9.x
OpenEdge 10.x
OpenEdge Category: Language (4GL/ABL)
FIX:
The following code assumes a connection to the sports or sports2000 database:
DEFINE VARIABLE fiCustName AS CHARACTER NO-UNDO FORMAT "x(20)"
VIEW-AS FILL-IN SIZE 35 BY 1.14 LABEL "Search".
DEFINE QUERY qCust FOR Customer SCROLLING.
DEFINE BROWSE bCust QUERY qCust
DISPLAY name
WITH 10 DOWN WIDTH 46 EXPANDABLE.
DEFINE FRAME fCust SKIP(1) fiCustName SKIP(1) bCust
WITH THREE-D VIEW-AS DIALOG-BOX SIZE 48 BY 14 SIDE-LABELS
TITLE "Customer Search".
DEFINE BUFFER bCust FOR Customer.
OPEN QUERY qCust FOR EACH Customer NO-LOCK BY Name.
ON VALUE-CHANGED OF fiCustName IN FRAME fCust DO:
IF (SELF:SCREEN-VALUE GT "") NE TRUE THEN DO:
GET FIRST qCust.
REPOSITION qCust BACKWARD 1.
LEAVE.
END.
FIND FIRST bCust WHERE bCust.Name BEGINS SELF:SCREEN-VALUE
NO-LOCK NO-ERROR.
IF NOT AVAILABLE bCust THEN
LEAVE.
REPOSITION qCust TO ROWID ROWID(bCust).
END.
ON WINDOW-CLOSE OF FRAME fCust
APPLY "CLOSE" TO THIS-PROCEDURE.
ENABLE ALL WITH FRAME fCust.
WAIT-FOR CLOSE OF THIS-PROCEDURE.