InterSystems Reporting - Rendering Report within CSP page
Our current reports for Provider Directory, are SQL based query class files that generate within the CSP page, then we have to click a Button to have it uploaded to a SFTP server via a Stream. Now that we have InterSystems Reporting installed we are looking to replace that process. How would I go about having a Link on the CSP render the report within InterSystems Reporting?
Comments
You can place a link on your CSP page that points to the InterSystems Reports server’s tryView.jsp, passing the report and catalog in the URL. The retrieved material explicitly says that tryView.jsp “is also a handy one to redirect a browser to if you want to link to a report.” It also says that if the user is not authenticated, the page redirects to login, and if report parameters are required but not supplied, it prompts for them. [1]
The basic approach is:
- Create your report in InterSystems Reports.
- From the CSP page, generate a hyperlink to the Reports server endpoint
jinfonet/tryView.jsp. - Pass at least:
jrs.report= report name including directoryjrs.catalog= catalog name including directory- optionally
jrs.result_type= output format, where1is HTML and2is PDF, etc.
- If the report uses parameters, add them as
jrs.param$<parameterName>=<value>. [1]
For rendering in the browser inside a page, HTML output is the relevant result type because the documented values include 1 for HTML and 2 for PDF. If you want the report displayed rather than downloaded as a PDF, use HTML output in the URL. [1]
A sample URL pattern based on the retrieved content would be conceptually like this:
http://<reportserver>:<port>/jinfonet/tryView.jsp?jrs.catalog=<encoded catalog>&jrs.report=<encoded report>&jrs.result_type=1
and for parameters:
...&jrs.param$Param1=value1&jrs.param$Param2=value2 [1]
If instead of a browser link you want to call it from ObjectScript and capture the output, the same source shows using %Net.HttpRequest against /jinfonet/tryView.jsp, setting jrs.report, jrs.catalog, jrs.result_type, and any jrs.param$... values, then copying the HTTP response into a %Stream.Object. [1]
The same material also notes that InterSystems Reports supports server-side scheduling and distribution, including FTP. A related source states that users can “Schedule reports to be distributed via email or FTP.” So if your current process is generating the report in CSP and then uploading it to SFTP, scheduled distribution from InterSystems Reports may be an alternative to custom stream-based upload logic. [2]
Sources: