Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » How to populate environment/schema-aware (or dynamically established) data sets for BIRT report(The data set should dynamically assign a schema to the query. BIRT does not seem to support this.)
How to populate environment/schema-aware (or dynamically established) data sets for BIRT report [message #1337227] Tue, 06 May 2014 19:35 Go to next message
Brian Gaugler is currently offline Brian Gaugler
Messages: 5
Registered: May 2014
Junior Member
What is the best BIRT-supported way to create a dynamic query using the BIRT data set? More specifically, I only want to focus on the schema right now.

SELECT * FROM <schema>.table_1

I have multiple data sources already established, one per region. However, within that region may be any number of databases. I'd like to dynamically choose which schema to use, using a Report Parameter perhaps.

I accomplished this using a @schema variable, which is swapped out with a value in the beforeOpen method.

This functions when generating a report, however it does not function within the Data Set setup and configuration. Exceptions are thrown. The column outputs are cleared. You cannot preview the results. It makes it pretty difficult to establish a dataset using this work-around.

Using a Report Parameter-

ie, SELECT * FROM " + params['SCHEMA'].value + ".table_1

directly did not yield any better results. I don't think it even worked.

Ideally, I am looking for a solution that does not result in Exceptions when I enter it into the data set query field and click OK.

Re: How to populate environment/schema-aware (or dynamically established) data sets for BIRT report [message #1371890 is a reply to message #1337227] Wed, 21 May 2014 15:30 Go to previous message
Kristopher Clark is currently offline Kristopher Clark
Messages: 130
Registered: January 2013
Senior Member
Brian Gaugler wrote:
> What is the best BIRT-supported way to create a dynamic query using the
> BIRT data set? More specifically, I only want to focus on the schema
> right now.
>
> SELECT * FROM <schema>.table_1
>
> I have multiple data sources already established, one per region.
> However, within that region may be any number of databases. I'd like to
> dynamically choose which schema to use, using a Report Parameter perhaps.
>
> I accomplished this using a @schema variable, which is swapped out with
> a value in the beforeOpen method.
> This functions when generating a report, however it does not function
> within the Data Set setup and configuration. Exceptions are thrown.
> The column outputs are cleared. You cannot preview the results. It
> makes it pretty difficult to establish a dataset using this work-around.
>
> Using a Report Parameter-
>
> ie, SELECT * FROM " + params['SCHEMA'].value + ".table_1
>
> directly did not yield any better results. I don't think it even worked.
>
> Ideally, I am looking for a solution that does not result in Exceptions
> when I enter it into the data set query field and click OK.
>
>

Hi Brian,
I like to change my query from the beforeOpen() of the data set. You
can do it a couple of different ways but to me, I think it's cleaner to
do from beforeOpen(). You have access to the parameters from there too.
So you could do something like

if(params['whatever'].value == "some value") {
this.queryText = "select * from table1";
else if(params['whatever'].value == "some other value") {
this.queryText = "select * from table2";
}......

You can also use parameters in the data source making thoes dynamic.
Previous Topic:showing/hiding a series based on data values?
Next Topic:bidirectionnal communication with report in iframe
Goto Forum:
  


Current Time: Fri Oct 24 18:05:35 GMT 2014

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

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