||ASP, ASP.NET(C#), ColdFusion, Java Servlets, JSP, Perl, Perl
| Here are the steps to follow to create Master-Detail forms on two pages (Master
page and Detail page).
In this example we shall use the Intranet example database with
departments as the master table and employees as the detail table.
1. Create a Master page and add Grid and Record forms to it using the Grid and
Record Builder. In the step where you select the link field from the grid to
the record form, select 'New Grid Column' radio button
and enter the desired name.
2. Create a Detail page and add Grid and Record forms the same way. While building
the Grid form, open the Visual Query Builder and add the departments table so
as to be able to display departments names on the form. At the end of this,
the department_name field should be in the 'Fields For the Grid' list as shown
At this point, you have two pages. The next step is to create a link from the
Master grid to the details page.
3. Open the Master grid form in design mode, and select a field you want to
use as the link to the detail page. Right click on it and select Change to Link.
4. Select the newly created link field and go to Properties window->Data
tab. Make sure, that 'Href Type' is set to "Page". Open 'Source/Parameters'
dialog and set the destination page to the page containing the detail forms.
5. In order to view employee records for a particular department, you need to
pass the department_id primary key field to the details form via the link field
created above. So while still in the Source/Parameters property, click on the
Plus icon under the Link Parameter section and add an output parameter with
the following settings:
Source Type: Data Field
Parameter Source: select the primary key field
from the field list (department_id)
Parameter Name: it is set to primary key name by
default, but you can change it if you want (department_id).
6. The last step is to add the passed primary key to the Where clause of the
detail grid form. Open the Data Source dialog for the detail Grid form. Click
the plus icon under the Where section and add a Table parameter as follows:
Condition Type: Parameter
Name: select foreign key field (department_id)
Name: should match the name specified as Parameter Name for Link field
When you click OK and return to the Data Source window, the condition under
Where section should be:
Save and generate the pages then proceed to test them by navigating between
the Master and Detail page.
Note, that the same approach could be used to create the master and detail forms
on the same page if desired.
37569 times. Last updated: 11/11/2002 9:01:08 PM