I have 2 bar charts in my report, each using 2 different subdatasets. My main query is something like "select * from user_levels" which is used only as a placeholder so that the main report can render the bar charts correctly, instead of displaying nothing.
My question is: how can I pass the same value/parameter at runtime into the 2 subdatasets? Does the parameter need to be only passed from the main query or can it be unrelated to the main query?
If anyone can please list out the steps specific to Jaspersoft Studio, I would be very grateful. I have spent at least 5 days on this so far.
Thanks for your time and help.
2 Answers:
Each dataset is independent; its fields are separated from the main dataset and also from other datasets and subdatasets.
There is a good tutorial on working with datasets in Jaspersoft Studio available here: http://community.jaspersoft.com/wiki/creating-charts-and-datasets-jasper...
Regards,
Ilona
Thanks for the reply, Ilona!
I've seen that tutorial before. It was quite informative and helped me understand how subdatasets can be setup and used. But one thing missing in that is the use of parameters.
Now I am beginning to think that subdatasets do not work with parameters or we cannot pass parent report parameters into them. Every which way I tried to pass parameters into subdatasets, it didnt work for me at all. So, I had to change my original report to work with subreports instead and they work with parameters from parent report.
The value for sub-datasets parameters are set by using the dataset run, which is part of each element that makes use of a sub-dataset. The dataset run is used to set the datasource that will produce the data for the sub-dataset, and also the parameters. The value for each parameter is set with an expression in which is possible to use all the main dataset objects, including parameters. This means that you can use main-dataset parameters to set the value of sub-dataset parameters.
Giulio
BUMP