Contents
Report template which can be printed or saved to PDF. Reports are usually printed from onCourse user interface, but can also be generated from within a script. For example:
report { keycode "ish.onCourse.studentDetailsReport" records ObjectSelect.query(Contact).select(args.context) }
Optionaly you can use extended list of arguments:
report { keycode "ish.onCourse.studentDetailsReport" entity "Contact" records ObjectSelect.query(Contact).select(args.context) background "backgroundName" param "dateRange_from" : Date.parse("yyyy-MM-dd", "2016-01-01"), "dateRange_to" : Date.parse("yyyy-MM-dd", "2016-01-02") }
'param' argument is Map<String, Object> which currently acceptable for dateRange_from/dateRange_to values. This parameters are required for some reports when you need to determine reportable period (the same possibility presented on user interface). If client app run in different time zone with server app you need to provide date range parameters in corresponded server time zone to be sure that output report result will correct: Date.parse("yyyy-MM-dd Z", "2016-01-01 +1100") If you want to print report from records source which has different type with report entity type (Account Transaction report from contacts records for example) then you need provide 'entity' (entity "Contact") parameter Keep 'param' map as generic (Object data type) to possible extension of acceptable arguments in future. 'background' argument is name of available ReportOverlay records which stored in onCourse system. You can manage it through user interface: File -> Preference -> Reports -> press on cogwheel (top right corner) -> 'Manage print backgrounds' This will return PDF report represented in binary format, which you can for example save to a file or send in an email as an attachment:
smtp { from "test@test.com" to "test@test.com" subject "report example" content "report printing example" attachment "report.pdf", "application/pdf", report { keycode "ish.onCourse.studentDetailsReport" records ObjectSelect.query(Contact).select(args.context) } }
public Report {
}
Add a tag to this object. If the tag requirements don't allow this tag to be added, then this method does nothing and returns false.
the tag you want to add
true if the tag is found and added
Add a tag to this object. You need to pass the full path to the tag, for example "Subjects/Arts/Painting". If the tag requirements don't allow this tag to be added, then this method does nothing and returns false.
the full path to the tag
true if the tag is found and added
the date and time this record was created
description of this report
root entity for this report
A report can be set to automatically chain another report to immediately follow it and print together.
the keycode of another report which follows this one
true if report is shown in the print dialog selection list (mainly used to hide subreports)
unique key code of this report
the date and time this record was modified
name of this report
Reports can be a list type where every record appears right after the previous, breaking pages only when we run out of paper. Or they can have a page break after each record. For example, each invoice might start on a new page.
the type of page breaking for this report
report as string
version number of this report
Check to see whether this object has this tag. Either pass the name of a tag (for example "Painting") or the full path to the tag, for example "Subjects/Arts/Painting".
the tag name or the full path to the tag
true if the tag is found and is attached to this object
Check to see whether this object has this tag or it's child tag. Either pass the name of a tag (for example "Painting") or the full path to the tag, for example "Subjects/Arts/Painting".
the tag name or the full path to the tag
flag to define whether need to find in children tags or not
true if the tag or it's children is found and is attached to this object
Remove a tag from this object. If the tag isn't already attached, this method does nothing and returns false.
the tag you want to remove
true if the tag was found and removed
Remove a tag from this object. You need to pass the full path to the tag, for example "Subjects/Arts/Painting". If the tag isn't already attached, this method does nothing and returns false.
the full path to the tag
true if the tag was found and removed