alvintkl Posted July 28, 2010 Share Posted July 28, 2010 Hi allHow to return a value calculated at subreport and return back to main report to use Link to comment Share on other sites More sharing options...
shainaztamboli Posted July 29, 2010 Share Posted July 29, 2010 hi,create a variable In subreport say returnValuevariable class type --> whatever u wantcalculation type --> nothingreset type and increment type -->nonevariable expression --> value you want to returnIn main report create variable with same name as returnValuevariable class type --> same as return typecalculation type --> nothingreset type and increment type -->nonevariable expression --> blankIn main report Subreport --> properties -->Subreport(other)-->subreport return values-->addSubreport variable--> variable name as returnValue(u want to return) local destination variable --> main report variable (returnValue)calculation type --> nothingand use that variable wherever u want .one more thing use evaluation time of that variable as report hope it will work for you-Shainaz Link to comment Share on other sites More sharing options...
alvintkl Posted July 30, 2010 Author Share Posted July 30, 2010 thank a lot Link to comment Share on other sites More sharing options...
hasan14192010 Posted July 17, 2013 Share Posted July 17, 2013 thank you for the solution ,but when i go to add no sub report variables are showed. only the basic ones are available. what do you suggest ? Link to comment Share on other sites More sharing options...
mo7medhosny Posted October 9, 2014 Share Posted October 9, 2014 same problem here Link to comment Share on other sites More sharing options...
mo7medhosny Posted October 9, 2014 Share Posted October 9, 2014 You have to write subreport variable name manually, jasper shows default variables only!! Link to comment Share on other sites More sharing options...
madhuri.thakur Posted November 18, 2014 Share Posted November 18, 2014 Hello, I did everything as suggested in the post. I have two sub reports and i am getting values from there. till now i am going good, i am getting values from sub reports to main reports. but the issue is, i am unable to do the total of two values, it is displaying null. Please help me out. Thanks & regards Madhuri Thakur Link to comment Share on other sites More sharing options...
thierry.siraut Posted January 16, 2015 Share Posted January 16, 2015 Hello, I have a NULL value returned from the subreport despite suggested by Shainaz configuration. Can you help me please ? Link to comment Share on other sites More sharing options...
mauricio Posted March 24, 2015 Share Posted March 24, 2015 Hello, same issue here, two variables defined on each report and subreport, same name, multiple attempts with different configurations, always get null using IReport4.1.3 thanks in advance for any help Link to comment Share on other sites More sharing options...
dasarishivasagar Posted August 10, 2015 Share Posted August 10, 2015 Hello, I am passing calculated variables from SubReport to MainReport i am getting result in MainReport but my issue is I am not getting exact value in my MainReport as like what my subreport calculated variable value is giving. it is giving -1th iterated value to main report. for example: i am calculating sum($F{Sal}) which need to sum 8 records of $F{Sal} in my subreport i am getting sum($F{Sal}) for 8 iterations which is correct and expected same variable i passed to my mainReport but in my MainReport it's value printing sum($F{Sal}) for 7 iterations which is wrong, it is skipping 1 iteration i am not getting why it is happening Please help me on this issue as soon as possible. Thanks in advance, Regards, Shiva. Link to comment Share on other sites More sharing options...
dasarishivasagar Posted August 10, 2015 Share Posted August 10, 2015 Hello, I am passing calculated variables from SubReport to MainReporti am getting result in MainReport but my issue isI am not getting exact value in my MainReport as like what my subreport calculated variable value is giving. it is giving -1th iterated value to main report.for example:i am calculating sum($F{Sal}) which need to sum 8 records of $F{Sal} in my subreport and i need to pass it to mainreportin my subreport that variable value i am getting sum($F{Sal}) for 8 iterations which is correct and expectedsame variable i passed to my mainReportbut in my MainReport it's value printing sum($F{Sal}) for 7 iterations which is wrong, it is skipping 1 iteration i am not getting why it is happeningPlease help me on this issue as soon as possible.Thanks in advance,Regards,Shiva. Link to comment Share on other sites More sharing options...
kapidi.dileep Posted December 21, 2017 Share Posted December 21, 2017 Hi all .... Can you please let me know.... i am also having same problem,and am getting null values Link to comment Share on other sites More sharing options...
jeanpierrepolnareff91 Posted February 25, 2020 Share Posted February 25, 2020 Hello everyone,I had a problem when following the solution of shainaztamboli, when I wanted to display the returned value of my subreport into my main report, the value displayed was null (but the variable weren't null in my subreport).I managed to find a strange solution : Delete resetType = "None" from my main report JRXML file :BEFORE :<variable name="returnValue1" class="java.lang.Integer" resetType="None"/>AFTER :<variable name="returnValue1" class="java.lang.Integer"/>Best regards. Link to comment Share on other sites More sharing options...
maxime.sonnetvinci-energi Posted June 12, 2020 Share Posted June 12, 2020 Hello everyone,Just a small correction to add to Shainaz's post:In the main report, the variable reset type should be REPORT and not NONE. Otherwise, you'll just have the "null" value. Link to comment Share on other sites More sharing options...
kubazap87 Posted June 23, 2022 Share Posted June 23, 2022 Hello everyonei have the problem that i always get only null values in the main report. in the subreport the variables are filled correctly but the transfer does not work. i have already set the rest type to none and report none of this works.does anyone have any ideas? 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