Kbase 16752: Example of Using Foreign Keys By Setting Attributes
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
Example of Using Foreign Keys By Setting Attributes
INTRODUCTION
============
This knowledgebase entry discusses a way to use foreign keys by
setting the attributes for a foreign key instead of supplying
that key from another object.
PROCEDURAL APPROACH
===================
Consider the following SmartWindow example:
- SmartQuery for Customers which will accept Sales-Rep as a
foreign key
- SmartViewer which displays Customer information (including
Customer.Sales-Rep)
- Navigation SmartPanel to navigate through the Customer records
You could have a SmartBrowser for Salesreps on the SmartWindow
which will supply Sales-Rep as a foreign key to the SmartQuery to
only show Customers that have whatever Salesrep is selected in the
SmartBrowser. As the user selects different salesreps in the
browser, a different set of customer records will be available
to navigate through.
Suppose you want to only display Customers with "SLS" as the
Salesrep in this SmartWindow and therefore would not need a
SmartBrowser for Salesreps displayed on this window. You could
do the following to implement this:
1) Create a local-initialize procedure in the SmartWindow that
does the following before running the standard initialize:
RUN set-attribute-list IN h_q-cust ('Key-Value = SLS').
RUN set-attribute-list IN h_q-cust ('Key-Name = Sales-Rep).
Refer to the SmartQuery's adm-open-query-cases internal procedure
to see how these attributes are used to change the query's
{&OPEN-QUERY}.
2) The SmartQuery should be able to accept Sales-Rep as a
foreign key but the Request Key instance attribute of the
SmartQuery should be set to (none) since it won't be
requesting a key from another SmartObject at runtime.
When this is run only Customers with Salesrep "SLS" will be in
the SmartQuery available for navigation by the user.
REFERENCES TO WRITTEN DOCUMENTATION
===================================
Progress User Interface Builder Developer's Guide
Progress Software Technical Support Note # 16752