Friday, August 26, 2011

BIRT Viewer Export Data

When using the AJAX based BIRT Viewer, a user has the option to show the table of contents, re-run the report with different parameters, export report data, export the report to XLS, PDF, PPT, DOC, PS, ODS, ODP, ODT formats, Print from the client, or print on the server. These options are available within the toolbar of the viewer.



The export data function allows the report user to export all the columns in the data binding collection for all data bound items in the report. To see the columns that will show up in the export, select the report item and choose the binding tab in the properties editor.



Within the Export Data dialog, users can configure the output encoding and separator to use when creating the output. Currently the separator supports comma, tab, semi-colon, colon, and vertical line separators.



By default BIRT will use the report element id to generate a name to populate the Available result sets drop down list. This is generally not a user friendly name. If the report designer names the report item in the general properties for a report item, this name will be used instead. In the image above the table is named “mytable”. By default all data bound items will be shown in the drop down list. BIRT provides an advanced property called Allow Export that can be set to true or false. If the value is true for a report item, the report items result set will be shown in the available result sets drop down. If the value is false, the result set will not be shown.




This property can also be set dynamically, using a beforeFactory script and the report elements name.



if( params["ExportChartData"].value == false ){
reportContext.getDesignHandle().findElement("mychart").setProperty("allowExport", false);
}
if( params["ExportTableData"].value == false ){
reportContext.getDesignHandle().findElement("mytable").setProperty("allowExport", false);
}


In this sample two Boolean report parameters are used to determine whether the allow export property should be set to false.



Other conditions can be used to make the decision on whether to display a report item in the available result sets drop down list. For example, from script you could call out to a Java object or access a session variable to make the decision.

The sample report is available at BIRT-Exchange.

3 comments:

Anonymous said...

when exporting report to csv it is showing column names as data set names but not the specified names in reprot..

Anonymous said...

when exporting report to csv it is showing column names as data set names but not the specified names in reprot..

Anonymous said...

Jason Can u sent me your reportdegisn pleas to look it because i have some problems
diego.sanchez@sileno.com