How to populate environment/schema-aware (or dynamically established) data sets for BIRT report [message #1337227] |
Tue, 06 May 2014 15:35  |
Eclipse User |
|
|
|
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 11:30  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.22912 seconds