BackPrevious Page Next PageNext

Running Reports

You can use the following JSP's to run reports via URL: tryView.jsp, runReport.jsp, and run.jsp. However Page Report Studio and Web Report Studio have permission control, so in order to run reports in Web/Page Report Studio you are required to have the Execute and/or Edit permissions on the reports.

The image illustrates the relationship between the JSPs:

JSP Relationship

tryView.jsp

This is the normal method of accessing reports using URLs. tryView.jsp can be used to run page reports and web reports to any allowed formats.

If the report has parameters and no parameter specified in the URL or the parameters provided in the URL fail to include all necessary parameters, the server then displays the parameter dialog for entering parameter values.

Below are some examples:

runReport.jsp

This JSP functions the same as tryView.jsp when the report has no parameters. When it has parameters, the report runs with the default parameters if no parameter values are specified, or else it runs with the parameters specified in the URL.

runReport.jsp can be used to run page reports and web reports to any allowed formats.

Below are some examples:

run.jsp

run.jsp can be used to run page reports in Page Report Studio and web reports in Web Report Studio. When it has parameters, the report runs with the default parameters if no parameter values are specified, or else it runs with the parameters specified in the URL.

run.jsp can also be used in the following scenarios:

In addition to the above JSPs, you can call the server servlet jrserver to run reports to any allowed format. However when you use servlet to run a report, JReport redirects the request to an appropriate JSP so it is recommended to use JSP to run the report directly. The following are two examples:

For detailed information about the properties that are included in the URLs, see Appendix 1: URL Properties.

Below are some more specific topics about running reports via URL:

Running a report tab in a page report

If you want to run a specific page report tab, use jrs.report_sheet$RPT_TAB_NAME=true to specify a report tab in the current page report, where RPT_TAB_NAME is the report name of the specific report tab, not the display name. For example, jrs.report_sheet$Report2=true.

To get the report name and display name of a page report tab you can open the page report in JReport Designer and look at the Instance Name property in the Report Inspector or you can make use of the API methods getName() and getDisplayName() in the interface jet.server.api.ReportSheetInfo. For the detailed usages, see the JReport Javadoc located in <install_root>\help\api.

The URL for running the report tab Financial report in Page Report Studio within the report Detail Report Corporate Overview.cls is as follows:

http://localhost:8888/jinfonet/tryView.jsp?jrs.catalog=%2fSampleReports%2fSampleReports.cat&jrs.report=%2fSampleReports%2fDetail Report Corporate Overview.cls&jrs.result_type=8&jrs.report_sheet$report2=true

Refreshing page report data automatically

When running a page report in Page Report Studio, you can ask JReport to automatically refresh the report data at certain interval. To achieve this, you need to run the report with run.jsp and add the following two properties in the URL:

The following is a URL example:

http://localhost:8888/webos/app/pagestudio/run.jsp?jrs.report=%2fSampleReports%2fEmployee Information List.cls&jrs.catalog=%2fSampleReports%2fSampleReports.cat&jrs.auto_refresh_data=true&jrs.auto_refresh_data_time=10

Opening web reports in Web Report Studio via JSON

JReport provides properties for developer users to run web reports in Web Report Studio via JSON (JavaScript Object Notation).

The following lists the properties that are encapsulated as JSON objects. It will help if you obtain some knowledge on JSON to understand the syntax more clearly.

When composing the URL, you need to use URL encoding to avoid errors.

Here is an example of the complete URL without URL encoding to make it easier to read:

http://localhost:8888/webreport/studio/entry/run.jsp?jrd_report={"name":"/SampleReports/report.wls","ver":-1}&jrd_catalog={"name":"/SampleReports/SampleReports.cat","ver":-1}&jrd_param$={"P_Coutry":"USA"}&jrd_security_file_name={"name":"SampleReports.security.xml"}&jrd_datasources=[{"ds":"Data Source 1","uid":"xxx","pwd":"xxx","type":0,"url":"xxx","driver":"xxx"},{"ds":"Data Source 2","type":2,"key":"xxx"}]

If you use absolute resource path, you need to add the property "real":true for the path. For example,

jrd_report={"name":"C:\\JReport\\Server\\jreports\\SampleReports\\Sales Detail Report.wls","real":true}&jrd_catalog={"name":"C:\\JReport\\Server\\jreports\\SampleReports\\SampleReports.cat","real":true}

Run Sales Detail Report.wls in the Public Reports > SampleReports folder:

http://localhost:8888/webreport/studio/entry/run.jsp?jrd_report={"name":"/SampleReports/Sales Detail Report.wls"}&jrd_catalog={"name":"/SampleReports/SampleReports.cat"}

Specifying the Web Report Studio mode

Web Report Studio has two modes: View Mode and Edit Mode. When opening web reports in Web Report Studio by URL, you can use the property jrd_studio_mode to specify the mode. If this property is not provided in the URL, the default mode set in the server profile will be applied.

Below are the values of the property:

However for web reports saved in public folders in the server resource tree, Web Report Studio adopts a permission control to restrict user access, so whether the specified mode can be opened depends on if you have the Execute and/or Edit permissions on the web reports: Execute for View Mode and Edit for Edit Mode. If you do not have the required permission on the public web report you are going to run:

Example:

http://localhost:8888/webreport/studio/entry/run.jsp?jrd_report={"name":"/SampleReports/Sales Detail Report.wls"}&jrd_catalog={"name":"/SampleReports/SampleReports.cat"}&jrd_studio_mode=view

Specifying the Page Report Studio view

Page Report Studio has two views: Basic View and Interactive View. When opening page reports or page report results in Page Report Studio by URL, you can use the property jrd_studio_mode to specify the view. If this property is not provided in the URL, the default view set in the server profile will be applied.

Below are the values of the property:

However for page reports and page report results saved in public folders in the server resource tree, Page Report Studio adopts a permission control to restrict user access, so whether the specified view can be opened depends on if you have the Execute and/or Edit permissions on the page reports or page report results: Execute for Basic View and Edit for Interactive View. If you do not have the required permission on the public page report or page report result you are going to run:

Examples:

Specifying a time duration for a task and notifying someone by e-mail

Take the following examples to specify a time duration for a report run task, and ask JReport Server to notify someone of the task status via e-mail if the task has not yet finished running when the task duration is up:

You can also set a message in the e-mail by setting the property jrs.timeout_sendmail_message.

For example, you want to display message as follows:

Running <report name> takes more than <Timeout> seconds.
The subject is <mail subject> and has been sent to <mailto> from <mailfrom>
It is a file whose type is <type>.

Then you can set the property in URL as follows:

jrs.timeout_sendmail_message=Running {6} takes more than {0} seconds.<p>The subject is {2} and has been sent to {1} from {5}.<p>It is a file whose type is {3}.

Where

{0} - The report timeout
{1} - mail to
{2} - mail subject
{3} - result type
{4} - mail comment
{5} - mail from
{6} - Catalog name/report
<p> - an Enter key

Example

http://localhost:8888/jinfonet/tryView.jsp?jrs.report=%2fSampleReports%2fEmployee Information List.cls&jrs.catalog=%2fSampleReports%2fSampleReports.cat&jrs.timeout_send_email=true&jrs.report_timeout=1&jrs.mailto=person@company.com&jrs.mailsubject=AboutTaskForTimeoutSendEmail&jrs.result_type=1&jrs.mailcomments=Employee Information List&jrs.mailfrom=person@company.com&jrs.timeout_sendmail_message=.This {6} is a large report whose runtime is over {0} seconds.<p>The report is sent to {1} from {5}.<p>The subject of the mail is {2}.<p>Its type is {3}.

Note: You should type the single quote sign " ' " twice if you use it in the message.

Switching the report database connection

When accessing reports via URL, you can switch the connection in the same database or between different databases at runtime by setting the properties: jrs.jdbc_url, jrs.jdbc_driver, jrs.db_user and jrs.db_pswd. As a result, if the databases you want to switch between have the same structure, you will then be free from having to build another similar catalog. You can use the switch database commands to set the JDBC connection or to change the user name/password in order to connect to another database.

See also:

Switching the connection and user/password in the same database

Switching the connection between different databases with the same database metadata

Switching the connection between different databases with different database metadata

When connecting to a different database with different database metadata or data metadata, you need to also specify the following properties to set the target database metadata information if there are differences:

The URL for switching the database to Oracle when running the page report report1.cls:

http://localhost:8080/remote/sub/jinfonet/tryView.jsp?jrs.catalog=/Test/Test.cat&jrs.report=/Test/report1.cls&jrs.cmd=jrs.try_vw&jrs.result_type=8&jrs.jdbc_driver=oracle.jdbc.driver.OracleDriver&jrs.jdbc_url=jdbc:oracle:thin:@192.168.0.1:1521:oracle9&jrs.db_user=test&jrs.db_pswd=1234&jrs.db_quote_character="&jrs.db_date_format=M/d/yyyy&jrs.db_datetime_format=d/M/yyyy h:mm:ss a&jrs.db_time_format=HH:mm:ss.SSS&jrs.db_transaction_readonly=Read Only&jrs.db_transaction_mode=Repeatable Read&jrs.db_char_to_be_replaced=}&jrs.db_char_replaced_by=}oracle91234

BackPrevious Page Next PageNext