Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsdynamic data set from different table different feilds, according to parameter
https://www.eclipse.org/forums/index.php/mv/msg/213638/684219/#msg_684219
I just start BIRT so might get some wrong way. And this might sounnds a common question here.
I would like to fetch different feilds from different table according to one parameter's value.
Say if parameter value is "Apple", I would do query:
select taste from table_fruit;
if parameter value is "Rice", I would do query:
select protein from table_grain;
I knew I can do something in data set "beforeOpen" to replace string. But how can I control both the table name and the field name with one parameter? I am sure there are plenty of solution for this thing.
Thanks.
]]>shengyongli2011-06-15T08:49:21-00:00Re: dynamic data set from different table different feilds, according to parameter
https://www.eclipse.org/forums/index.php/mv/msg/213638/684399/#msg_684399
column types? In the before open you can check any report parameter and
set the query to whatever you want
if( params["food"].value == "Apple" ){
this.queryText = "select * from table_fruit";
}else{
this.queryText = "select * from table_grain";
}
The only issue is that both tables have to have the same column metadata
or you will get an error.
Jason
On 6/15/2011 4:49 AM, forums-noreply@eclipse.org wrote:
> Hi,
> I just start BIRT so might get some wrong way. And this might sounnds a
> common question here.
>
> I would like to fetch different feilds from different table according to
> one parameter's value.
> Say if parameter value is "Apple", I would do query:
>
> select taste from table_fruit;
>
> if parameter value is "Rice", I would do query:
>
> select protein from table_grain;
>
>
> I knew I can do something in data set "beforeOpen" to replace string.
> But how can I control both the table name and the field name with one
> parameter? I am sure there are plenty of solution for this thing.
> Thanks.
>
>]]>Jason Weathersby2011-06-15T14:15:30-00:00Re: dynamic data set from different table different feilds, according to parameter
https://www.eclipse.org/forums/index.php/mv/msg/213638/684631/#msg_684631
Alternatively, I can do it in another way.
Say I have a list item in report, how can I bind it to different data set according to param's value? Thanks. ]]>shengyongli2011-06-16T00:17:23-00:00Re: dynamic data set from different table different feilds, according to parameter
https://www.eclipse.org/forums/index.php/mv/msg/213638/684708/#msg_684708
and then use the parameter to drop one of them. for Example name the
two tables in their general properties to table1 and table2. Then in
the beforeFactory do this:
if( params["type"].value == fruit ){
reportContext.getDesignHandle().findElement("table1").drop();
}else{
reportContext.getDesignHandle().findElement("table2").drop();
}
You could always write de-api to change the column data in a script but
it will be more code than the above approach.
Jason
On 6/15/2011 8:17 PM, forums-noreply@eclipse.org wrote:
> Thanks for the info. The issue came the two tables have different column
> numbers and name. According to param, the data set need to select
> different column from different table, but give same output. For
> example, choose "taste" (string) from table "fruit", and choose
> "protein" (string) from table "grain". Is it possible?
> Alternatively, I can do it in another way.
>
> Say I have a list item in report, how can I bind it to different data
> set according to param's value? Thanks.]]>Jason Weathersby2011-06-16T04:57:41-00:00Re: dynamic data set from different table different feilds, according to parameter
https://www.eclipse.org/forums/index.php/mv/msg/213638/685216/#msg_685216
shengyongli2011-06-17T03:39:18-00:00