Consultor Eletrônico



Kbase 17912: How to change the query of a browser in V9
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   6/5/2002
How to change the query of a browser in V9

INTRODUCTION
============
This knowledgebase entry describes how to replace a static query of
a browser with a new dynamic query using the browser's QUERY
attribute.

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

2) Suppose you have 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 chosen 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.

Progress Software Technical Support Note # 17912