Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » How to switch datasource using javascript?
How to switch datasource using javascript? [message #1061295] Fri, 31 May 2013 04:58 Go to next message
Rina Tan is currently offline Rina Tan
Messages: 4
Registered: May 2013
Junior Member
I have a report using datasources from a library. Now I want to assign datasource for my dataset at runtime based on a parameter. How can I do it using javascript from report design?

Thanks
Re: How to switch datasource using javascript? [message #1061527 is a reply to message #1061295] Sun, 02 June 2013 03:02 Go to previous messageGo to next message
Michael Williams is currently offline Michael Williams
Messages: 1639
Registered: July 2009
Senior Member

Is the other dataSource in the library as well? Can you explain the situation some more?

Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Re: How to switch datasource using javascript? [message #1061775 is a reply to message #1061527] Mon, 03 June 2013 21:56 Go to previous messageGo to next message
Rina Tan is currently offline Rina Tan
Messages: 4
Registered: May 2013
Junior Member
yes, the othere datasource is in library as well. The report that I am working on has two data sources that added from library. There's a parameter on the report indicates which data source the data set should use at runtime. At begining I thought there should be a java script function 'setDataSource()' or something of data set, but I only found getDataSource(), there's no setDataSource(). Can anyone help me with it?

Thanks
Re: How to switch datasource using javascript? [message #1062494 is a reply to message #1061775] Sat, 08 June 2013 05:41 Go to previous messageGo to next message
Michael Williams is currently offline Michael Williams
Messages: 1639
Registered: July 2009
Senior Member

Try something like this in the beforeOpen of the dataSet:

this.setExtensionProperty("dataSource","otherDataSourceName");


Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Re: How to switch datasource using javascript? [message #1063268 is a reply to message #1062494] Wed, 12 June 2013 21:22 Go to previous messageGo to next message
Rina Tan is currently offline Rina Tan
Messages: 4
Registered: May 2013
Junior Member
This doesn't work. Any other idea?
Re: How to switch datasource using javascript? [message #1063276 is a reply to message #1063268] Wed, 12 June 2013 21:53 Go to previous messageGo to next message
Rina Tan is currently offline Rina Tan
Messages: 4
Registered: May 2013
Junior Member
I think I found a solution. In initialize of report add this reportContext.getDesignHandle().getElementByID("idOfDataSetElement").setDataSource("dataSourceName");
Re: How to switch datasource using javascript? [message #1064381 is a reply to message #1063276] Wed, 19 June 2013 04:38 Go to previous message
Michael Williams is currently offline Michael Williams
Messages: 1639
Registered: July 2009
Senior Member

Great! Glad you found a solution. I was out of town the end of last week, so I've not been able to make it back in here, til now. Smile Let us know whenever you have questions!

Michael

Add interactivity, scheduling, sharing, live Excel export, and JS integration to your BIRT app with the new, free BIRT server, BIRT iHub F-Type.
Previous Topic:Integrating perspective BIRT into RCP application
Next Topic:Change grid cells content dynamically
Goto Forum:
  


Current Time: Thu Oct 23 22:16:19 GMT 2014

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

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