how to return value from the subreport

0

Hi all

How to return a value calculated at subreport and return back to main report to use

alvintkl's picture
Joined: Dec 9 2009 - 7:34pm
Last seen: 6 years 1 day ago

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 and i need to pass it to mainreport
in my subreport that variable value 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.

dasarishivasagar - 3 years 9 months ago

5 Answers:

3

 hi,

create a variable In subreport  say returnValue

variable class type --> whatever u want

calculation type --> nothing

reset type and increment type -->none

variable expression --> value you want to return

In main report create variable with same name as returnValue

variable class type --> same as return type

calculation type --> nothing

reset type and increment type -->none

variable expression --> blank

In main report  Subreport --> properties -->Subreport(other)-->subreport return values-->add

Subreport variable--> variable name as returnValue(u want to return) 

local destination variable --> main report variable (returnValue)

calculation type --> nothing

and use that variable wherever u want .

one more thing use evaluation time of that variable as report

 

hope it will work for you

-Shainaz

shainaztamboli's picture
Joined: May 31 2010 - 1:58am
Last seen: 6 months 2 weeks ago
-1
thank a lot
alvintkl's picture
Joined: Dec 9 2009 - 7:34pm
Last seen: 6 years 1 day ago
1

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 ?

hasan14192010's picture
Joined: May 24 2013 - 12:57am
Last seen: 5 years 10 months ago

same problem here

mo7medhosny - 4 years 7 months ago
-1

You have to write subreport variable name manually, jasper shows default variables only!!

mo7medhosny's picture
Joined: Oct 8 2014 - 3:48am
Last seen: 4 years 7 months ago
-1
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
madhuri.thakur's picture
Joined: Oct 20 2014 - 6:16am
Last seen: 3 years 5 months ago

Hello, I have a NULL value returned from the subreport despite suggested by Shainaz configuration. Can you help me please ?

thierry.siraut - 4 years 4 months ago

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

gusantor - 4 years 1 month ago

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.

dasarishivasagar - 3 years 9 months ago
show 1 more...

Hi all ....
Can you please let me know....
i am also having same problem,and am getting null values

kapidi.dileep - 1 year 5 months ago
Feedback
randomness