Reporting : Native reporting system : How to use subreports : Report specification requirements : Report level
  
Report level
HTML and SAXT subreport stylesheets have been prepared to present an additional heading for the type of item being reported, if the following line is present at the start of the subreport:
SELECT "Name" LEGEND "Invisible"
It is very important to include an ORDERBY statement at each level of the report, particularly the top level of subreports, which should cover all selections. Not doing so can cause data to be left out in SAXT Reader results, and can mean that results will appear differently if you switch to an alternative format or report execution mechanism. An example is switching between SAXT Reader and SAXT Updater.
SUBREPORT command
Within a report level you can have:
SUBREPORT "report-name" { [parameters] }
Usage notes
1 There can be more than one subreport.
2 The sequence dictates the sequence that the columns appear in, but note that all columns from all levels of the main report appear first, then the columns of the first subreport that was executed, and so on.
Parameters
REPORTFILE "file-name"
Where file-name can be specified without a path if it is expected to be in the same folder as the current report file, or it can be specified with a complete drive:\path.
DDIDBYPARAMETER [ TRUE | FALSE ]
Where FALSE is the default and causes insertion of the following statement at the top of the subreport:
WHERE Identity = <Identity value of the current record from the parent report>
If TRUE is specified then the SASUBDDID keyword allows the use of the current Identity value from the parent report to be used to constrain subreport output.
SUBREPORTCLASS, SUBREPORTTYPE, SUBREPORTPROP
Note Not yet supported by SAXT Reader. See below.
SUBREPORTPROP "property" specifies that a subreport will be run for each reference of the named property. The property must be selected, but it can be given a ##invisible## legend to force it to be hidden.
SUBREPORTCLASS, SUBREPORTTYPE specify class and type numbers that must be matched for the subreport to be run. If not specified then the subreport is always run. Only one class and type can be specified. The last to be specified is what is used.
For SAXT Reader, or for an alternative layout, just place the following statements at the top level of the subreport to get the equivalent behavior:
SELECT Name LEGEND "Invisible" REM "Use this legend to hide it"
JOIN
WHERE REFERENCES = "property"
JOIN
SELECT "Name" LEGEND "Name", "Class", "Type" REM "Use a legend here if you want to show the name"
WHERE Class = Definition REM "Class Restriction goes here"
WHERE "Type Number" = 1367 REM "Type Restriction goes here"
Using this structure gives better results anyway, since when using two subreport statements to report on more than one property, and the first one produces no results, a cell will not be skipped in the generated table.
Related topics
Grid style
HTML
SAXT Reader
Parent topic
Report specification requirements