Getting Started-2-Tier |
An additional screen is provided in tutorstd.lib
that uses a grid widget to display a list of distributors. In this lesson, you enhance this screen so users can query the database for a specific distributor record through two different search criteria: either a distributor ID number or a partial or full name string. The transaction manager uses user input to generate automatically the appropriate SQL query statement. If a query field is empty, the transaction manager excludes its data from the SQL generation.
In this lesson you learn how to:
The Library TOC opens.
tutorstd.lib
is not among the list of open libraries:
tutorstd.lib
from the list of open libraries and lesson10.clt
from the list of library members. Choose Open.
The lesson10.clt
screen opens in the editor workspace.
This screen is a master-only screen for the distributors
table and uses a grid format. The grid contains three of the table's columns: distrib_id, distrib_name
, and distrib_phone
.
dstslect.scr
in client.lib.
Increase the screen's vertical dimension so you can add other widgets to it.
dstslect.scr
client screen in one of the following ways:
Make room for more widgets above the grid widget by moving the grid widget and push buttons down to the screen's lower portion.
You want to populate the screen with widgets that are associated with a particular database table. You can access these widgets in the repository, just as the screen wizard does.
data.dic
in the proltut
directory.The Open Repository Entry dialog opens and displays the contents of the data.dic
repository.
distributors
repository entry and choose OK.
The distributors@[Repository
] window opens.
You can use widgets from the repository to serve as query fields on the dstslect.scr
screen. When you create a copy of a repository widget, the copy has an inheritance link to its parent in the repository. You can use inheritance to propagate changes from the repository to application screens, as shown in the next lesson.
In the following steps, you copy distrib_id
and distrib_name
from the repository to the client screen dstslect.scr
. The copies inherit their property values from the repository.
distributors
repository screen, Shift+click to select the Distrib_id
label and its corresponding text widget (distrib_id
), and the Distrib_name
label and its corresponding text widget (distrib_name
).
Selecting multiple widgets creates a selection set, which is useful for defining common property values. The first widget you select is the dominant widget. You can Ctrl+click on another widget in the selection set to make it dominant.
More About Selecting More than One Widget
When more than one widget is selected, the first one you select is considered the dominant selection and is indicated by little solid black squares around its border (square brackets in character mode); all other widgets in the selection set are indicated with hollow boxes (curly braces ({}) in character mode). The position and size of the dominant widget determines how the other widgets in your selection set will align or resize when you use Edit menu or toolbar options.
There are a variety of ways to select multiple widgets:
distributors
to the top of the screen dstslect.scr
.
It is good practice to name all data entry widgets, especially if you need to access them programmatically. Names of all widgets on a screen must be unique. Because the dstslect.scr
screen already contains widgets named distrib_id
and distrib_name
, the copies from the repository are left unnamed. You need to assign different names to the copies via their Name property.
dstslect.scr
and set each one's Name property (under Identity) as follows:
Use database properties to provide the transaction manager with information it needs: identify the query fields, define the data to retrieve, and ensure that query field data is not used to update the database.
distid_qbe
and distname_qbe
widgets.
CHANGE DATA
. Under CHANGE DATA
, set the following property for both widgets:
NEW DATA
. Under NEW DATA
, set the following property for both widgets:
FETCH DATA
. Under FETCH DATA
, set these properties for both widgets:
distname_qbe
widget.like
%.
The percent sign (%) sign is a wildcard matching any sequence of zero or more characters. This pattern matching operator tells Panther to search the database for all records that contain the string in the distname_qbe
field.
You can try it out!
http://hostname/cgi-bin/webAppname/dstslect.scr
The Select Distributor screen opens.
Or choose FileTest Mode to view the screen in a GUI environment.
Note: You may need to start the web application server before viewing the screen in your browser.
Vid
in the Distrib_name
field.All distributors that have Vid
in their name are listed in the grid.
Distrib_id
field and choose
.
Panther looks for a record with an exact match—a distrib_id
with a value of 6. The record corresponding to ID 6 is displayed in the grid.
You enhanced a screen so users can search for distributors by name or ID. You did this by performing these actions:
You learned:
What did you learn?