m.lorenzini Posted February 24, 2022 Share Posted February 24, 2022 Hi everyone,I search a lot far and wide for this point, but I didn't find any solution.My problem is that I have to create a report that does two different queries an shows different set of data (every set, needs to be grouped before been rendered).So I decided to split my main report into two subreports (one for every query).This is my situation:- main report does not do any query or datasource connection- sub report 1 has a query for himself, if I run this subreport alone it works perfectly- sub report 2 same as subreport 1- when i run main report, no data is displayedMy problem is that when I publish on report server the main report, I do not connect any datasource/query to the main report, doing this I get no data displayed every time I execute the report.Is there a way to create multiple datasource/query on the main report and then pass those to subreports?I need to do this kind of parametrized queries because we have production and development environments so, we have 2 different datasource (one for every env)Thanks in advance,Matteo. Link to comment Share on other sites More sharing options...
Solution bigalex Posted February 24, 2022 Solution Share Posted February 24, 2022 The only way I know of to have a connection to multiple data sources is to use connection parameter(s). Suggestion is:Use one of the subreports as the main report or at least use the same data source (you can select the data source and then place on the main report query something like- Select 1 from dual )Create Parameter (i.e., $P{Subreport2_conn}) on the main report to use for connection to the data source in Subreport2:Class: java.sql.ConnectionIs For Promting: UncheckDefault value Expression: java.sql.DriverManager.getConnection("jdbc:oracle:thin:@YourServerIP:YourServerPort/yourdatabase","UserID","Password")Not sure what your drive is; in my case, it is jdbc:oracle:thinSet the Connection Expression in Subreport2 to $P{Subreport2_conn}I was using the same approach to connect five different data sources from one report.I hope this helps. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now