A master-detail relationship is a form that shows the detail records from a child table to a selected record in the master table. In PHsPeed, the master-detail relationship is for that reason realized by binding two dataset components (i.e. two DBTable components) on a shared key.


The fastest way to create a simple grid is by using the application wizard, to create the forms for you. Then make some modification to the generated DBTable components. The 'trick' is that you need to be able to generate a second form in an already existing one. 


  • Use the application wizard to generate your form (all database aware forms are allowed including the popup version).
  • Start the application wizard, but instead of entering a unique module name, enter the module name that you want to insert the new form.
  • Select the form type and enter the appropriate fields (how to create forms of a certain type is described in another how-to)
  • Click on Create module. PHsPeed will popup with a warning that the generated module will be appended to the existing one. Accept.


Now you have created a form with two panels, one referring to your master, one to your detail. It is possible that the sequence of the panels are wrong, then you can select a panel with your mouse and drag/drop it into the right place (master on top).

The only thing to do now is to apply the master-detail relationship.


  • Click on the detail dataset



Look at the property editor and find the master datasource. Use the drop-down to select the datasource of the master

  • Open the master data mapping property.
  • Select the key from the master table and the key that maps it to. Click on the arrow down button to generate the mapping. (You can repeat this step if your key has more fields.)




  • Generate and run the code by clicking on the double green arrow



You now created a master-detail form