3.9. Creating a Secondary Module

Secondary datasets typically contain larger numbers of records than primary datasets and new records are added frequently. Our application will have only one secondary module, named “Invoices”.

An invoice consists of a header where some general attributes are described (number, date, customer …​) and invoice lines with the list of products, their quantities, prices, etc. It is convenient to have two grids for such documents: the main one (master) showing the data invoice header data and the detail one showing the invoice lines.

We want to place two TDBGrid components on the invoice form and link a separate TDataSource to each of them that will be linked to its respective TFDQuery. In our project, the dataset with the invoice headers (the master set) will be called qryInvoice, and the one with the invoice lines (the detail set) will be called qryInvoiceLine.