Database Guide
You can change the SampleDatabaseApplication to implement a
wildcard search on the database. The following example explains how to
create a query that enables users to enter a string in a text field, such as
"%", "M%", or "S%" and search the database for values
that match the string.
To enable the SampleDatabaseApplication for wildcard searches,
make the following changes to it:
- Change the Department number label to Job
type.
- Open the settings for the text part, and change the Data type
setting from Decimal to String.
- Open the settings for the multi-row query part. Edit the query and
change the WHERE clause to STAFF.JOB LIKE :job.
- On page 2 of the Query tab in the settings notebook, select the
Host variables button.
The Edit host variable window displays.
- If necessary, change the data type for the :job variable
to Database VarChar Field.
Note: | Wildcard searches will not work on fixed-length character variables.
Make sure you set the data type to variable-length character to implement a
wildcard search.
|
- Edit the attribute-to-attribute connection between the multi-row query
part and the text part and change the dept attribute to
job.
- To test these changes, select the test button in the Composition
Editor. Try searching the database by typing %, M%, S%, or
C% and selecting Find.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]