MyReport Query Template Specification
< Return to MyReport Index
MyReport can make use of multi-statement SQL queries stored as report templates. This function is available from the command line and through the HTML interface.
Report templates are valid SQL with embedded parameters which may be passed into the query at run-time. The embedded parameters are implemented with a special case of ordinary SQL comment syntax (’/*...*/’) so there are no special requirements placed on the template or it’s maintainer.
MyReport extracts and tests all required parameters from the report template and requires no ‘prior knowledge’ of their use.
MyReport can also create either a skeletal, or a working report template from the command line, allowing the user to interactively create and test a query, or part of a complex query, then write it to a template file for future use.
The template format is available to the user via the ’-S’ option:
myreport -S
MyReport Template Source File Specification
There are two sections to each report specification:
1 - Report info block
2 - Query block (must follow the report info block)
Multiple report specifications may be included in one file.
'/*' as the only non-space characters on a line opens a report info block.
'Report:' at the beginning of a line indicates the report title.
'Database:' at the beginning of a line indicates the default database.
'FormName:' specifies name of form to be used with HTML front end
'Description:' at the beginning of a line indicates the beginning of a
section of descriptive text, possibly multi-line, which ends with the
next recognized token, or the close of the report info section.
'*/' as the only non-space characters on a line closes an info block.
The query block(s) consist of everything following the report info block,
including single line comments. The query must be written in ordinary SQL
syntax and ends with ';' as the only non-space character on a line.
Parameters to be substituted at report time must appear within the query
text at the locations where they are used, and must be enclosed in comment
markers with NO internal spaces. For example, /*VAR*/.
------------------- Example report specification -------------------------
/*
Report:Title of report to follow
Database:database_name
FormName:form_name
Description:Some text to describe meaning or use of this report.
The description may span multiple lines.
*/
/* Embedded comments must be single line and include at least one space */
select /*COL*/ from /*TABLE*/ where /*WHERE*/ order by /*COL*/
;
|