Report wizard
Introduction
Normally, report designing in ReportWorshop starts from a document: the user creates a rich text document, then links data to the whole document or its parts.
While this approach is very flexible, it may be hard to use.
In this update, we added a new action:
This action can generate a new report template from data.
Currently, the following data providers support this action:
- data providers that use SQL data queries
- data providers with predefined master/detail relationship.
Most data providers included in Report Workshop are SQL-based, so this action can be used with them.
A predefined master/detail relationship can be defined in universal DB data provider:
TRVReportDBDataProvider on datasets that have MasterSource:TDataSource property.
This action can generate a simple report, or a master/detail report. The number of levels of details is not limited, so complex reports can be generated. However, there is a limitation: one detail for each master. This limitation comes from the step-by-step design of a wizard dialog. Let me know if you are interested in removing this limitation.
The action generates SQL queries for master/detail reports automatically.
- [+] About spaces in table and field names
-
Data queries for this actions are generated by data provider components.
If datasets or field names have spaces, they must be quoted for using in SQL statement.
All data providers use double quotes to make SQL identifiers. The exceptions are data providers for MySQL: TRVReportMyDataProvider (for DevArt MySQL DAC) and TRVReportMySQLDataProvider (for MicroOLAP DAC for MySQL); they use backtick characters for identifiers.
There may be a problem with data providers that work with multiple DB engines, if the chosen engine does not support double quotes for SQL identifiers.
You can assign the following properties of data provider:
- SQLIdentifierOpenQuote (double quote by default)
- SQLIdentifierCloseQuote (double quote by default)
- SQLStringQuote (single quote by default)
Note: if table and fields names do not include space characters, data providers do not use quotes.
Wizard dialog
On each level of data, the user chooses:
- source of data (a dataset) and how it is linked to the previous levels (correspondence between fields)*
- how this data is displayed in the document
- which fields of this data source to display in reports
*if master/detail relationship is predefined, the wizard does not ask how details are linked.
Data can be placed in reports as:
- text (multiple paragraphs)
- table (each field in a separate column)
- one-column table (all fields in the same cell)
- cards
- paragraph (in a comma-delimited list)
- Top-Level-Report-Types.png (11.62 KiB) Viewed 48090 times
If you specify "Cards" with one card per row, the result will be the same as for one-column table. The difference will be on the next step. For cards, details are displayed inside the card. For tables, details are added outside of the previous level (at the right side or below)
If a master data is a table, details can be attached in several ways:
- as new columns to the right
- inside a new cell to the right (using the options listed above)
- inside a new cell below (using the options listed above)
- How-To-Place-Details-in-Table.png (13.9 KiB) Viewed 48090 times
The report wizard stops when
- the user clicks "Finish" button, or
- the user chooses "No details" for the next data source, or
- the last step's placement does not allow details (for example, a list in a single paragraph), or
- all tables have been used
The user can define the report header, footer, and the outermost table header.
As a result, the wizard generates a new report template. It is ready-to-use, but of course you can edit it as you want.
Formatting
If the target editor does not use named styles (UseStyleTemplates=False), all text in the resulting report template uses the same font.
If the target editor uses named styles (UseStyleTemplattes=True), the resulting report template is formatted according to the StyleTemplates, see
AccentedTextStyleTemplateName, ReportFooterStyleTemplateName for details.
By default, the action resets style templates to default values using the linked
TrvActionNew action. If you want to generate a report template using the current style templates, assign
UseCurrentStyleTemplates=True.