Running an Existing Report
Methods defined in the JadeReportWriterManager and JadeReportWriterReport class enable you to dynamically override JADE Report Writer report details at run time. If you want to reimplement access security in the report at run time, subclass the JadeReportWriterSecurity class and reimplement the methods defined in that class.
To run an existing report
-
Create a transient instance of the JadeReportWriterManager class.
-
Call the setSecurity method, passing an instance of the JadeReportWriterSecurity subclass.
-
Call the setUserName method, passing the user name of the current user.
-
Call the getReport method, passing the name of the report. If the report does not exist or it is not accessible to the current user, this method returns null. If the report exists and it can be accessed by the user, it returns a transient instance of the JadeReportWriterReport class.
To use the transient instance of the JadeReportWriterReport class returned by the getReport method of the JadeReportWriterManager class:
-
Call the setOutputDestination method, passing the type of report output that you require (that is, output to the printer or to one of the valid file types).
-
If you want to use the current report output option values or you want to see the existing values before setting new ones, you can retrieve these by calling the appropriate get methods to obtain the current values.
-
Call the appropriate set methods (for example, setPageOptions and setPreviewOptions for a report to output to the printer or setOutputFileTitle for a report to a file, and so on).
-
If the report uses parameters (typically for report selection), set these individually by using the setParameter method, passing the parameter name and value.
-
If the report has more than one profile defined for it, call the setProfile method to set the profile on which you want to report, passing the profile name.
-
When the report setup is complete, call the JadeReportWriterReport class run method to start the report.
Alternatively, run the report by calling the JadeReportWriterReport class runWithStatus method if you want to display and refresh a progress dialog and return the success of the report and the page count if the report was output to a printer or the record count if the report was extracted to a file.
-
You can retain the JadeReportWriterReport instance to run further copies of the report, if required. To do this, repeat steps 1 through 6, as appropriate.
-
When you no longer require the JadeReportWriterReport instance, you should delete it so that you clean up all associated report definition transient objects that are associated with it.