Providing data with a report template
To enable the Report Studio user to use a template with a data object, add an editable table element to the template. When a user selects a template containing an editable table element, Report Studio prompts the user to select a data object or information object data source. Report Studio then prompts the user to select the data fields to display in the report table.
If you are creating a template that includes data, create a data source and data set that specifies the data that the Report Studio user can display in the report. You can define multiple data sources and multiple data sets in a template. When the user selects a template with multiple data sets, Report Studio prompts the user to select one of the data sets to use for the report. For information about defining data sources and data sets, see BIRT: A Field Guide.
Using a CSV file as a data source
A Report Studio report design can use a comma-separated values (CSV) file as a data source if the CSV file is a predefined data set in a report template. To use the file as a data source, copy the CSV file to the appropriate directory. To determine which directory to use, download the report template (.rpttemplate) file to a local directory and save it as an XML file. In the XML code, locate the <data-sources> element, shown in the following example:
<data-sources>
<oda-data-source
extensionID="org.eclipse.datatools.connectivity.oda.flatfile"
name="Data Source" id="266">
<text-property name="displayName">Data Source
</text-property>
<property name="HOME">C:\</property>
<property name="CHARSET">UTF-8</property>
<property name="INCLTYPELINE">YES</property>
</oda-data-source>
</data-sources>
The HOME or URI property shows the directory in which to place the CSV file.
Excluding a data set
You can exclude a data set in a template from the Select Data dialog in Report Studio. For example, you want to display stock quote data from a web service in the report, but you do not want the user to manipulate the data. To exclude a data set from the Select Data dialog, set the data set’s UsageInBRS property to excluded in the template’s XML representation. For example, the following code excludes the Orders data set:
<oda-data-set extensionID="org.eclipse.birt.report.data.oda.jdbc
.JdbcSelectDataSet" name="Orders" id="8">
<list-property name="userProperties">
<structure>
<property name="name">UsageInBRS</property>
<property name="type">string</property>
<property name="isVisible">true</property>
</structure>
</list-property>
<property name="UsageInBRS">excluded</property>