gparker Posted October 25, 2013 Share Posted October 25, 2013 I have a report with a number of tables in it. I want to use a Date parameter I setup in the main report section in the queries of the sub-datasets for the tables.I've tried adding a parameter to the sub-dataset, then adding that parameter to the table, using the parameter in the main report as the default expression, but when I run a preview, it tells me it can't find the parameter in the main report.I've also tried mapping the paramter to the table, but that results in a ClassCastException error.I've attached the report below (it's a pretty basic report, as I'm a beginner at this). The only sub-dataset I've put a parameter in so far is "trial." The parameters are "runDate" in the main report and "runTimeDate" in the sub-dataset. The first table, titled "trial," is the one I've been testing this with. I think the query in the dataset has the reference to runTimeDate still in it. I've changed it a number of times, just trying to get it recognized, let alone run.Thanks for any help! Link to comment Share on other sites More sharing options...
Solution Thomas Zimmer Posted October 26, 2013 Solution Share Posted October 26, 2013 The parameter "runDAte" in your main report is of type java.sql.DAte. The subset's parameter "runTimeDAte" is of type String, change the former and you'll succeed.You won't have to set a default value for the dataset's parameter, as you pass an actual value in the table within you use that dataset :-)Cheers, Thomashttp://www.thomaszimmer.net Link to comment Share on other sites More sharing options...
gparker Posted October 29, 2013 Author Share Posted October 29, 2013 I'm still getting the following error - Parameter not found : runDate. I have both parameters as the same type, java.lang.String. The dataset's parameter doesn't have a default value, since it would be getting it through the table itself, if I understand the second part of your answer correctly. I removed the default value for the main parameter as well, since it should prompt for the date. Things seem to be in place, but it still doesn't work. Link to comment Share on other sites More sharing options...
gparker Posted October 29, 2013 Author Share Posted October 29, 2013 Oh, I changed the type to java.sql.Date now since I'm trying to get a date into the sql query. And thanks for your help! Link to comment Share on other sites More sharing options...
gparker Posted October 29, 2013 Author Share Posted October 29, 2013 Annoying update: I can create a new report, setup a new main parameter, new table and sub-dataset, creating a new parameter for that dataset, and it works. I don't understand why it won't work in the other report! Link to comment Share on other sites More sharing options...
gparker Posted October 29, 2013 Author Share Posted October 29, 2013 Worked it out. The parameter names need to be the same. This apparently tricks the compiler into thinking that there is only one parameter. I'm pretty sure this is an XML issue, since the subDatasets (and therefore, the subDataset's parameters) get called before the main parameters, which doesn't make any sense to me. Maybe there's some reason for that, but I don't see it yet. Thanks again for the help! Link to comment Share on other sites More sharing options...
Thomas Zimmer Posted October 30, 2013 Share Posted October 30, 2013 Could you post the stack trace of the other report? as it is so big, I´m honestly not excited to look more closely. maybe the stack trace says something.. :-) 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