Consultor Eletrônico



Kbase P128113: How to change the query of a Browser widget
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/03/2009
Status: Unverified

GOAL:

How to change the query of a Browser widget

GOAL:

How to use dynamic queries with a Browser widget

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x
Windows
OpenEdge Category: Language (4GL/ABL)

FIX:

1) Create a browse widget with a static query for each customer.

2) Suppose the application has a fill-in field which accepts a city name and
button to change the query based on the city name entered by the
user. Create the following CHOOSE trigger for the button:

ON CHOOSE OF btn-search DO:
DEFINE VARIABLE q-hdl AS HANDLE.

CREATE QUERY q-hdl.
q-hdl:SET-BUFFERS(BUFFER Customer:Handle).
q-hdl:QUERY-PREPARE("FOR EACH Customer WHERE " +
"Customer.City BEGINS '" + srchcity:SCREEN-VALUE + "'".
q-hdl:QUERY-OPEN.
ASSIGN brws-cust:QUERY = q-hdl.
END.

When the search button is pressed, a dynamic query is created to
open the query for customers where their city begins with the
value entered in the city fill-in. This query is opened and the
browser is now assosiated with this new query instead of the
original static for each customer query.

Note when changing the query handle for a browser that the query
must have the same underlying database fields and the same number
of tables as the original query. And database queries and temp-table
queries cannot be intermixed. You can change a database query for
a browser with another database query but cannot change it to a
temp-table query.