Expanding templates at runtime
Genero Report Writer provides the option to add data sources and the associated mapping to a template at runtime. Therefore, you can provide end users with generic reports that can be expanded at runtime.
This method uses a report template (.4rt) and design-time APIs to provide the details about the schema, the schema root, the relationships, and the field mappings in order to output the report, bypassing any need for a report design document. While more complex to set up, the advantage is that changes to your template are reflected with each new run of the report.
Generic reports typically present themselves to end users in the following three phases:
- The user is prompted for information regarding the template to use and the values to use
(variables and placeholders). While all the same options as sophisticated as the template
assistant in the report designer are available, typically the following things will be
simplified:
- You can't choose multiple different templates. If choices are given, they are limited to styles that match the data source (e.g. don't offer a grouped list when the data source doesn't have groups).
- You won't be prompted for difficult placeholders, for example those that require the construction of formulas (e.g. Total expressions), and will only be prompted for simple values (e.g. the Title of the report).
- You must choose fields from a single list of fields. Therefore, templates that offer more than one field lists will not be used.
Note: Building the dialog in a generic way to avoid hard coding placeholder and field lists requires software that can introspect schema files and .4rt files. A library is provided for that. - The information entered by the user is used to expand the template and generate a
.4rp file.Note: Expanding the template can be done in one of two ways:
- By calling an existing library function.
- By invoking the GenerateReport executable provided with GRE.
- The data source is run using the generated .4rp file. Note: The data source is run with the .4rp via the normal runtime API functions.