Consultor Eletrônico



Kbase 15707: One Way to Change the Selection Criteria of a SmartBrowser
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
One Way to Change the Selection Criteria of a SmartBrowser

INTRODUCTION
============
This knowledgebase entry discusses one way to have the
selection criteria of a SmartBrowser be determined by the
user running the application. This example demonstrates
how a fill-in object on a SmartWindow is used as selection
criteria for the query of a SmartBrowse that is contained
by the SmartWindow.

PROCEDURAL APPROACH
===================
The example discussed is a SmartWindow that contains the
following:
1) A SmartBrowser for Customer table
2) A fill-in field, called state-criteria, labeled "State".
When state is entered by the user, the SmartBrowse will
only show customer records for that state.

The SmartWindow would need a fill-in on page 0 which
would have the following trigger code in "on return" and
"on leave" triggers for the fill-in:

DO:
/* h_B-QRY is the handle for the SmartBrowser */
run set-attribute-list in h_B-QRY
("STATE-CRITERIA = " + state-criteria:screen-value).
run dispatch in h_B-QRY ('open-query':U).
END.

This sets a user-defined attribute called STATE-CRITERIA to
whatever the user has entered on the SmartWindow for State.
It then runs dispatch to open the query which will refresh
the records in the browse using what the user has just
entered.

The SmartBrowser would need have a freeform query which
would include the following in the OPEN_QUERY trigger:

run get-attribute("STATE-CRITERIA").

OPEN QUERY br_table FOR EACH Customer
where Customer.State = return-value NO-LOCK.

This uses the attribute, STATE-CRITERIA, set in the
SmartWindow as selection criteria when the query is
opened for the SmartBrowser.

The above logic could also be applied and used with
a SmartQuery.

REFERENCES TO WRITTEN DOCUMENTATION
===================================
Progress Version 8 User Interface Builder Developer's Guide


Progress Software Technical Support Note # 15707