sureshk Posted July 24, 2006 Share Posted July 24, 2006 Hi, Is there any workaround to pass parameters between subreports?. Subreports are in a main report detail section.I can do this if it is in Last page footer or summary, not working if it is placed in any other section. Any help will be really crossing one more milestone in iReport design. Regards Suresh Link to comment Share on other sites More sharing options...
JulEgner Posted August 11, 2006 Share Posted August 11, 2006 I also have a Subreport in detail Area, and I am able to get return Values from the Subreport, but it seems impossible to give the Subreport return Value to a Subreport as parameter.Is it possible to pass Values between Subreports? Link to comment Share on other sites More sharing options...
JulEgner Posted August 11, 2006 Share Posted August 11, 2006 I also have a Subreport in detail Area, and I am able to get return Values from the Subreport, but it seems impossible to give the Subreport return Value to a Subreport as parameter.Is it possible to pass Values between Subreports? Link to comment Share on other sites More sharing options...
lucianc Posted August 11, 2006 Share Posted August 11, 2006 If both the subreports are placed on the same band, straightforwardly passing a value returned from one of the subreport to the second one would not work because the value is not yet returned at the time the parameter value expressions are evaluated. There are (at least) two ways to work around this (I assume that the second subreport is placed under the first one):Introduce a dummy group which breaks at each row and place the second subreport in the group's footer. This ensures that the parameter values for the second subreport are evaluated after the first subreport returned the value.Don't use the standard mechanism for returning values from subreports, use a value holder subreport parameter instead. The first subreport would use a dummy expression to save the value in the holder and the second one would retrieve it from the holder.[/ol] HTH,Lucian Link to comment Share on other sites More sharing options...
JulEgner Posted August 11, 2006 Share Posted August 11, 2006 I understand the first solution, but not the second one. Could you describe what you mean with a holder? i cannot use the first solution (and maybe not even the second) because I have only one Subreport in the Detail Band, that gives a return value back.I want to take a value from the subreport and give it to the (same) subreport in the "next" detail value.I want to use this to start calculating values in the Subreport from a startpoint I know from the last Subreport. I want to use this for faster Report generation. Link to comment Share on other sites More sharing options...
lucianc Posted August 11, 2006 Share Posted August 11, 2006 If you want to pass the value returned from a subreport to the same subreport in the next detail row, the straightforward approach should work. Be careful to set calculation="System" and not to set resetType="None" for the variable in the master report. See the attached sample. By a holder I meant an object which can store a value, something likeCode:class Holder { Object value; void setValue(Object value); Object getValue();} You could have a variable of this type in the master, pass it to the subreport as a parameter and, in the subreport (using a scriptlet or a dummy expression), store a value in the holder. The same holder would be passed to the second subreport which would retrieve the value from it. HTH,Lucian [file name=subrep.zip size=1261]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/subrep.zip[/file] Link to comment Share on other sites More sharing options...
JulEgner Posted August 15, 2006 Share Posted August 15, 2006 Thats working! I set calculation=system and resettype=report (Variables in master report), and now I get the variable from the subreport to the mainreport and back to the subreport in the next row. Thank you. 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