Extra practice
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:
1. Change the Department number label to Job type.
2. Open the settings for the text part, and change the Data type setting from Decimal to String.
3. Open the settings for the multi-row query part. Edit the query and change the WHERE clause to STAFF.JOB LIKE :job.
4. On page 2 of the Query tab in the settings notebook, select the Host variables button.
The Edit host variable window displays.
5. 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.
6. Edit the attribute-to-attribute connection between the multi-row query part and the text part and change the dept attribute to job.
7. 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.
Last modified date: 01/29/2015