Jump to content

how to return value from the subreport


alvintkl

Recommended Posts

  • Replies 14
  • Created
  • Last Reply

Top Posters In This Topic

 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

Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...
  • 1 month later...

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

  • 1 month later...
  • 2 months later...
  • 4 months later...

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

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.

Link to comment
Share on other sites

  • 2 years later...
  • 2 years later...

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

  • 3 months later...
  • 2 years later...

Hello everyone

i 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...