Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
dynamically binding a dataset to a table
kkan
Hi can anyone out there help
I have two datasets
orders and Categories
both include columns of same name
In BIRT I want to programmatically bind a table to either datset.
looking at previous post i have given the tablea defauly dataset which is categories
Next in various event I have put the following code:
mytable = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("tblOrderItems");
mytable.setProperty( "dataSet", "Orders" );
at the moment this is in beforeOpen event of Categories
Now this has not errored but my problem is
1) how do i assign the table columns to show data from new assigned table i.e Orders
2) this is based on a condition on wheter any row are returned from Orders so really i should put this code in the onFetch of Orders but is it still ok to bind table columns to Orders..??
All Help is hugely appreciated Thanks!!
Find more posts tagged with
Comments
mwilliams
Do you use a parameter to decide which dataSet to use? If so, a simple way around this would be to create both tables and in the beforeFactory method, drop the unneeded table at run time based on the parameter.
kkan
would those table be created dynamically or in design layout?
kkan
quick ques - how do I retrieve the name of the datasource my report is using?
thanks K
mwilliams
You could create the two tables in the design layout and drop one in the beforeFactory. If you were creating a dynamic table, you'd create it in the beforeFactory, so it'd be close to the same solution only you'd have the ease of using the designer to build your table.
As for the dataSource question, I'm not sure I understand. The report can have multiple dataSources and use all of them. An element can have only one source though. Please explain this question a little more!
kkan
I want to be able to retrieve the actual source filename to which my data source is connected to. As this is an xml file and will be read for retrieving tags in the scripts I would like to know how can I pick up the file name of the Data source element. also because how this XMl file will be set up each report will have a different source file so not always will it be known what the name is
Thanks K