Using a Query in Forms and Reports

When the query is actually used (in a report described in the next section), then it is used in a context which provides some additional structure at the Rekall level. To do this, Rekall allows the selection of a "top" table and then, on the basis of the relationships between the tables, will work out a sensible grouping. For instance, the Clients table is chosen as the "top" table, then the report would be constructed as a report-subreport with clients in the report, and orders and products in the subreport (ie., the report will group orders up by client). Conversely, if the Products table is chosen, then the report will group orders up by product. Finally, if you chose the Orders table then a simple flat report would result.

Bear in mind that this grouping is indepenent of any group by or having expressions. Essentially, Rekall uses the relationship information to decide on a grouping, and then groups up the data as it is retrieved from the server database. For instance, if the Clients table is chosen as the "top" table there the data will be grouped up on the basis of the primary key value from the Clients table.

The query properties dialog that appears when you use a Rekall query in a form or report has a property Top-level table which is used to select the top table. The dialog will show a illustration of the effect of choosing a particular table; in the screenshot below, the Client table has been so chosen:

Lastly, when you use a Rekall query in a form or report, there are options to set additional where and order by expressions. These modify the query for just that form or report.