hk_report represents a report. It is a general report generator, that means it is able to not only print Postscript, hk_report is able to create any kind of text output. See set_reporttype().
the datasection, which is the only section, that has not a sibling.
the pageheader section and the pagefooter section,
the reportheader section and the reportfooter section.
Self defined sections are grouped in pairs (a header and a footer section), which will be managed by a container object of type hk_reportsectionpair. To create a new sectionpair use new_sectionpair() and new_sectionpair_at().
Inherits from hk_presentation.
returns a hk_reportdata object identified by a unique identifier number
returns a hk_reportdata object identified by a unique text identifier
loads the report definition from a file, where 'name' is the name of the report
Saves the report to a file, where 'name' is the name of the file. if 'ask' is true and the report already exists you will be asked before the old report will be overwritten. Returns True if successful else False.
returns the hk_reportsection object which represents the data section.
returns a new hk_reportsectionpair object which embraces the other sections.
returns a new hk_reportsectionpair object at position 'position. The most outside position is 0.
moves an existing hk_reportsectionpair relative to the other existing hk_reportsectionpair objects. The 'actualposition' is the current position of the sectionpair to be moved Parameter 'steps':positive values move it closer to the datasection, negative values move it away.
returns the page header section of type hk_reportsection. The page header section will be printed once at the beginning of every page.
returns the page footer section of type hk_reportsection. The page footer section will be printed at the end of every page.
returns the report header section of type hk_reportsection. The report header section is printed once at the beginning of the report.
returns the report footer section of type hk_reportsection.The report footer section is printed once at the end of the report.
Set the starting pagenumber if the first page should not start with 1.
returns the first page number.
Sets the filename of the report. It will be used for the output of the report. If you don't give the report a name the report and use_standard_storagepath() is false will be printed at the standard output. See also set_fileextension().
returns the filename
The output filename will be completed with this extension, i.e. '.ps' for postscript files
returns the file extension.
sets the report type 'name'.
returns the set report type
returns a list of all available report types.
Here is how to start a report:
Example 2.10. displaying a report
myreport=hk_this.datasource().database().new_reportvisible() myreport.load_report("complexreport") myreport.set_mode(myreport.viewmode)
A visible object in a report is of type hk_reportdata, which inherits from hk_dsdatavisible. The main methods are
set_data(const hk_string& d)
The data property contains the value that is displayed. See the knodatutorial chapter "The report field" for details.
The following example shows how to print numbers in different colours. For this we use the "onprint" action
Example 2.11. reportdata onprint
value=hk_this.column().asdouble() if value<0: hk_this.set_foregroundcolour(hk_red) else: if value==0: hk_this.set_foregroundcolour(hk_black) else: hk_this.set_foregroundcolour(hk_blue)