Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Embedding a datasource in the rptdesign file?
Embedding a datasource in the rptdesign file? [message #757719] Mon, 21 November 2011 10:57 Go to next message
js Missing name is currently offline js Missing nameFriend
Messages: 73
Registered: July 2009
Member
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?
Re: Embedding a datasource in the rptdesign file? [message #758098 is a reply to message #757719] Mon, 21 November 2011 21:16 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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?
Re: Embedding a datasource in the rptdesign file? [message #758169 is a reply to message #758098] Tue, 22 November 2011 08:48 Go to previous messageGo to next message
js Missing name is currently offline js Missing nameFriend
Messages: 73
Registered: July 2009
Member
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.
Re: Embedding a datasource in the rptdesign file? [message #758310 is a reply to message #758169] Tue, 22 November 2011 17:04 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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.
Previous Topic:How to show total of stacked bars
Next Topic:Dynamic parameter properties
Goto Forum:
  


Current Time: Thu Apr 25 17:43:32 GMT 2024

Powered by FUDForum. Page generated in 0.02928 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top