Guest Posted May 21, 2013 Share Posted May 21, 2013 Good morning everyone, I have been facing a problem on iReport 4.6.0.What I would like to do is use an attribute that's in my report's Detail section in a subreport which is also in the detail section of my report. So that I can retrieve datas in my subreport according to the value of my attribute in the nesting report. (By attribute I mean a field from my query in my nesting report)I anyone has any idea how to work this out, it would be great !Cheers. Link to comment Share on other sites More sharing options...
Thomas Zimmer Posted May 22, 2013 Share Posted May 22, 2013 Check the setting of your subreport element, there is an option "Parameters". Her you can set an expression which is passed into a Parameter of your subreport. The expression can be a literal, variable, field or anything else of your main report. The Parameter in the subreport then can be used in the subreport´s query or elsewhere...you have a similar functionality for returning values from your subreport into the main report...check the examples in iReport "Help > Samples > Subreport"Cheers, Thomashttp://www.thomaszimmer.net Link to comment Share on other sites More sharing options...
Guest Posted May 22, 2013 Share Posted May 22, 2013 Thanks for your answer Thomas,But I am kind of lost in all this, I don't know how to pass the parameter from my master report to the subreport.I checked the 'Subreport' example, and the fact that using the different values of 'shipcountry' in the subreport is exactly what I want to do, but I cannot figure out how it is done.If you can help me with that I would be gratefull :) Link to comment Share on other sites More sharing options...
Solution Thomas Zimmer Posted May 23, 2013 Solution Share Posted May 23, 2013 just click on the subreport element in the visual representation of your report. Then search the setting "Parameters" in the "roperties-View (you can de-/activate via the menue)finally set a parameter-pass: "Subreport parameter name" must be an existing parameter in your subreport, "Value expression" ca be anything, a parameter, variable or field (as described earlier) or just a static string.I attached the sample reports her again, because in my iReport installation only one of the subreports opens; either i crashed this or it comes like this within the installation (that would not be nice...).In the example "master" report, you can see that the field $F{SHIPCOUNTRY} is passed to the subreports. In the subreports the parameter is used in the queries, for example: select * from orders where shipcountry = $P{shipcountry}I hope this helps.Cheers, Thomashttp://www.thomaszimmer.net Link to comment Share on other sites More sharing options...
Guest Posted May 30, 2013 Share Posted May 30, 2013 Ok I got it, thanks for th detailed explaination :) 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