Accessibility
 
Home > Products > UltraDev > Support > Building Common Applications
Dreamweaver UltraDev Icon Macromedia Dreamweaver UltraDev Support Center - Building Common Applications
Defining a filtered recordset for the results page

Once the user specifies a search parameter and submits it to the server, the results page on the server retrieves the search parameter, searches the database, and builds a recordset with the records found (if any). You can have the results page perform all these tasks by defining a filtered recordset for it.

To define the recordset for the results page:

1 In UltraDev's Document window, choose File > New File to create a new page or open a predesigned search page.
Make sure the file name of the results page matches the value you specified for the action attribute of the HTML form on the search page (see step 7 in Obtaining the search parameter from the user). This ensures that the server processes the results page after the user clicks the form's Submit button.
2 Create a new recordset by opening the Data Bindings panel (choose Window > Data Bindings), clicking the plus (+) button, and selecting Recordset (Query) from the pop-up menu.
3 The simple Recordset dialog box appears.
If the advanced Recordset dialog box appears instead, switch to the simple Recordset dialog box by clicking the Simple button.
4 Enter a name for the recordset and choose a connection.
Use a connection to a database that you want the user to search.
5 In the Table pop-up menu, select the table to be searched in the database.
Note: In a simple search like this one, you can search for records in only a single table. To search more than one table at a time, you must use the advanced Recordset dialog box and define a SQL query.
6 Select the data you want to include in the recordset (and to display on the results page later) by selecting columns in the table.
Click Selected and choose the desired columns by Control-clicking (Windows) or Command-clicking (Macintosh) them in the list. In the following example, four visible columns are selected in the EMPLOYEES table.

Use the Recordset dialog box to create a recordset filter that excludes records that don't meet a specified search condition.

To create the filter for the recordset:

1 From the first pop-up menu in the Filter area, select the table column that contains values similar to the search parameter.
For example, if the parameter sent by the search page is a department name, select the column in your table that contains department names. In our table, that column is called DEPARTMENT.
2 From the pop-up menu beside the first one, select the equal sign (it should be the default).
Choosing equal (=) means that the user wants only those records in which the value of the selected table column is exactly the same as the one specified on the search page.
3 From the third pop-up menu, select Form Variable if your search form uses the POST method, or URL Parameter if it uses the GET method.
This pop-up menu specifies where the value sent by the search page is currently stored on the server. In Microsoft's Active Server Pages (ASP), for example, the value is stored in the Request.Form collection if the search form uses the POST method. If the search form uses the GET method, the value is stored in the Request.QueryString collection.
4 In the fourth text box, enter the name of the form object used to enter the search parameter on the search page.
You can obtain the name by switching to the search page, clicking the form object to select it, and checking the object's name in the Property inspector.
For example, suppose you want to create a recordset that includes only employees from a specific department. Assume you have a column in the employee table called DEPARTMENT, and that the HTML form on your search page uses the GET method and contains a Menu/List object called listDept listing department names. Here's how your Filter section should look:


 

5 If you want, click Test, enter a test value, and click OK to connect to the database and create an instance of the recordset.
The test value simulates the value that would otherwise have been passed by the search page. Click OK to close the recordset.
6 If you're satisfied with the recordset, click OK.
The next step is to give the page the ability to display the search results. You can do this in a number of ways. This article outlines the most basic way—by using a table and a repeated region. If you need more than one page to display the results, see the following article: "Displaying Results on Multiple Pages."

To Table of Contents Back to Previous document Forward to next document