Originally Written by Michael Williams
Calling Reports by URL
When the only integration you care about is to be able to link out to a design from your application or webpage, a simple URL will do. If you’re upgrading your open source application to use BIRT iHub F-Type, you can use the same pattern of URL as you did with the open source viewer, so upgrading is relatively painless.
If you’re not adapting an open source application your URL would look more like this one:
If you can’t remember the URL pattern, don’t worry. All you need to do is go into the iHub UI, run your design by clicking on it, drop down the menu, and click the “Link to this page” option.
The top option in this window is a link to the design. Copy that and use it wherever you need to.
There are lots of URL parameters available to customize what you get from your URL. One example of this is adding __format=pdf to the above URL:
This will tell the BIRT iHub F-Type to return the PDF copy of the report output.
Using the JSAPI
If you copy and paste this into a HTML page, then open it up in the browser, you’ll see the following:
As you can see, the entire viewer is embedded into the page allowing you to step through all 11 pages of the report. There are many settings and features that can be set with the JSAPI to customize your embedded content.
For example, if you bookmarked an item in your report and would like to only embed that single element into your page, you only need to add a single line of script. In the report I used for this blog, I have bookmarked the chart with “myChart”. Inside the myInit function, we simply use the line viewer1.setReportletBookmark(‘myChart’); and we get a single page in the viewer showing just the chart:
Now, what if we don’t want to show the toolbar? To get rid of that, we would just add options.enableToolBar(false); and we’d see just the chart with no toolbar:
The report and sample HTML page used in this blog will be posted in the devShare, soon. I will update the blog with a link when it’s available.
Thanks for reading. If you have any questions or comments, please feel free to use the comments section below or visit the BIRT iHub F-Type forum. You can also find more information about the BIRT iHub F-Type in the deployment guide and documentation.
For more blogs in the “Introducing BIRT iHub F-Type” series, see the list below:
- Installing iHub F-Type: Windows | Linux | VMWare Image
- Connecting to Data and Creating a Design
- Sharing Designs and Other Resources