Knowledge Base (Display) Knowledge Base (Display)

Birt reports compatibility

Birt reports compatibility

The current distribution .war file integrates the 4.2 birt report engine. The next releases will embed the latest birt versions as soon as they are available.

Most of the existing birt reports  should perfectly work on the visioneo reportlet. However, there are some exceptions explained in this article.  

Servlet request functions

This is the major cause of issues. Some reports embed scripts which use the reportContext.getHttpServletRequest() object.  For instance, to get the current remote user within a report: 

reportContext.getHttpServletRequest().getRemoteUser()

 

If it is used with the visioneo reportlet, this function returns null and will probably make your report fail. Beyond the fact visioneo uses a portlet request and not a servlet request, a report should not have to deal with this kind of issue, and guess itself in which context it runs.

There are several ways to get the remote user in the visioneo reportlet, for instance:

reportContext.getAppContext().get("visioneo.remoteuser")

and for the principal user:

reportContext.getAppContext().get("visioneo.userprincipal")

If some of your reports use the remote user ID, you can (and you probably should) keep compatibility both for Eclipse WebViewer and the reportlet with  a javascript function which returns the appropriate value. For example:

if (reportContext.getHttpServletRequest()!=null){

     return reportContext.getHttpServletRequest().getRemoteUser();
} else if (reportContext.getAppContext().get("visioneo.remoteuser")!=null) {
     return reportContext.getAppContext().get("visioneo.remoteuser");
} else {
    return "guest"
}

 

Session attributes

Some reports use the request session to store / retrieve informations, with something like:

reportContext.getHttpServletRequest().getSession().getAttribute("myAttributeInformation");

This won't work with the reportlet, because it is using a portlet request, not a servlet request. The portlet request can be accessed in a BIRT report context like this: 

reportContext.getAppContext().get("visioneo.portlet.request").getPortletSession().getAttribute("myAttribute");

However you should use it with cautions, because the cache engine does not take session attributes in consideration. If you need to exploit user attributes in your reports with Visioneo, please refer to this article.

Resource path

Most of the time, people are a little bit confused with resource path. If your reports use for example static images, Birt libraries, or javascript files, these elements must be located in the resource path. On Eclipse Web Viewer, by default it is the application root folder, but this is different with visioneo reportlet: you must copy your resources under the folder specified by a parameter in portlet.xml, default is:

<visioneo reportlet root>/birt/resource 

Please refer to the knowledge base article "How to add report & sub-folders" to get more informations about resources.

Client-side javascript

If you are not sure what is a client-side javascript code in a birt context, you can visit this post  from Jason Weathersby. Not to be confused with javascript code commonly included in items events of your reports, which is not concerned by this section.

In fact client-side javascript is very rare in Birt reports, it is added through text items with "HTML" tag. This often allows to improve the reports interactivity, but is difficult to embed and overall very difficult to maintain. In visioneo samples, the most representative client-side javascript example is in the report "Sales cross-table by product vendor", it mimics a drill down feature. 

For maintenability considerations, include client-side scripts in your reports only if it is absolutely necessary!  

Most of the time, the existing client-side code won't work within visioneo reportlet, because in a portlet context your html IDs must be namespaced. That means if you define an ID on a report item (through the "bookmark" property), the real final html ID will be <name space><your bookmark ID>. Therefore, your client-side javascript must use this namespace too, to be able to access html elements. That is the only difference to make a client-side work with visioneo.

Cache management

Visioneo embeds a powerful persistent cache which can be shared across users. More informations available in the knowledge base article "Document & rendering cache".

Cascading parameters 

This feature is not yet implemented, it is scheduled for further releases. Though a report should still run even if this parameter type is used, the parameter dialog will replace the cascading widget  by a simple text input.

Trouble shooting

If you encounter an issue with one of your reports by using the reportlet, the first thing to do is to check if it works or not with the Eclipse Birt WebViewer.

If it works with the WebViewer, and you can't pinpoint the precise cause with the log messages (the birt engine logs and the visioneo logs), the safest way to make it fix is to reproduce the bug on the birt sample database "Classic cars", or provide a sample data file. You can then post your report .rptdesign on the forum, or send it at: dpardon@visioneo.org.

 

Tags: admin developers
Average (0 Votes)
Most Recent