I have a rptdesign file with some xml and csv datasources that I store to disk after the content has been previewed by a user.
I need to read this file in another report application with the same datasources and values. It could be nice if it was possible to read the rptdesign file and the datasources were embedded in the file. Is this possible or must datasources always be specified from an external resource?
Are you writing out a rptdocument? It has the data in it. You could
use a data extraction task in the report engine api to extracts data
from report items like charts and tables.
Jason
On 11/21/2011 5:57 AM, js wrote:
> I have a rptdesign file with some xml and csv datasources that I store
> to disk after the content has been previewed by a user.
>
> I need to read this file in another report application with the same
> datasources and values. It could be nice if it was possible to read the
> rptdesign file and the datasources were embedded in the file. Is this
> possible or must datasources always be specified from an external resource?
I have changed my approach a bit. I first read the chart stored in a .chart file which has a predefined datasource/dataset (primary used to be able to setup colors and other ui styles).
At runtime I populate the dataset using:
public void setValues(SeriesDefinition axis, List<Float> values) {
Double[] arr = new Double[values.size()];
for (int i = 0; i < arr.length; i++) {
Float val = values.get(i);
if (val != null) {
arr[i] = new Double(val);
}
}
NumberDataSet seriesValues = NumberDataSetImpl.create(arr);
axis.getSeries().get(0).setDataSet(seriesValues);
}
Then the chart is previewed/rendered using swing. I then serialize the chart. But when working with a .chart file I don't have a way to generate it to a rptdocument - unless I embed it inside a .rptdesign file first.
If you do embed the chart you can always use the data extraction task to
get the chart data.
Jason
On 11/22/2011 3:48 AM, js wrote:
> I have changed my approach a bit. I first read the chart stored in a
> .chart file which has a predefined datasource/dataset (primary used to
> be able to setup colors and other ui styles).
>
> At runtime I populate the dataset using:
>
>
> public void setValues(SeriesDefinition axis, List<Float> values) {
> Double[] arr = new Double[values.size()];
> for (int i = 0; i < arr.length; i++) {
> Float val = values.get(i);
> if (val != null) {
> arr[i] = new Double(val);
> }
> }
> NumberDataSet seriesValues = NumberDataSetImpl.create(arr);
> axis.getSeries().get(0).setDataSet(seriesValues);
> }
>
>
> Then the chart is previewed/rendered using swing. I then serialize the
> chart. But when working with a .chart file I don't have a way to
> generate it to a rptdocument - unless I embed it inside a .rptdesign
> file first.