Chapter 13. Executing Forms and Reports with Parameters

It is sometimes neccessary to run a form or a report with one or more parameters. For instance, it may be useful to be able to run a report which only outputs information between a pair of dates. Related to this is the ability to invoke a form (or a report) with a master-child relationship, just like you can have nested blocks in a single form.

Rekall has two mechanisms for these. The first, more general case, is parameters. Parameters may be embedded inside object attributes (for instance, inside the where attribute associated with a table or query), and the user can be prompted for values when the form or report is run. The second is an explicit master-child mechanism, which is described in a later section.

Values for parameters can also be supplied when a form or report is run. This does not occur when the user directly runs a form or report (by double-clicking on the forms tab of the database dialog), but can be used when a form or report is started by a script.

Using Parameters

A parameter can be inserted into any text attribute. For example, the following is a where expression which accept records whose field EntryDate is between two dates:

        (EntryDate >= ${from_date}) and (EntryDate < ${to_date})
      

The text ${from_date} will be replaced by whatever the value of from_date is. The value is supplied either by the user via a parameter dialog, or via a script. Additionally, the form ${name:defval} may be used; in this case, if name is not otherwise defined, then defval will be used. This is useful in where expressions like:

        Company like '${Company:%}'
      

In this case, a pattern can be supplied which filters by company name; if no pattern is supplied then % matches all companies.

An example in the dialog below, which is accessed by going to Block Properties and clicking the Query button.