Jump to content
We've recently updated our Privacy Statement, available here ×

How to return values to master report from subreport?


Novaa

Recommended Posts

Hello Jaspersoft Community,

i cannot return Variables to my Master report. Can somebody help? Or Explain me how to return values.

 

Subreport Variable:

return_sub.PNG.ea717eebd4eca32a31999ba6c806a18c.PNG

 

 

 

 

 

 

Displayed Content of the Sup Report:

return_sub_display.PNG.b96e797c129ac27a96fb3dabd3ce0cf5.PNG

Main Report Variable:

Main_.PNG.d296fbd7b3e1c0d2e3b19ffb53d00ab5.PNG

Return Values:

Main_retrunvalues(1).PNG.04144852e3861d32088bd0a3d8bac876.PNG

 

Displayed Content in Main Report:

Main_display.PNG.3c8c3944e830cc9b3f26e793e09d1b31.PNG

 

 

 

 

 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Thanks for your Answer :)

Now i have an other Problem. I want to make an Expression with the Variable that came from the Subreport but my Expressions doesn´t work.

I have used this IF CASES:

$V{Column_number2} != BigDecimal.ZERO

$V{Column_number2} != null

Regards

Novaa

 

Link to comment
Share on other sites

  • 6 years later...

Hi, I recommend you pass those values as a param to the report, so you must calculate BEFORE calling the report, let´s say you have a list of items, iterate over the list make the sum, and store it in a variable, then add it as a param, "amount", this variable must be added to the report.

BigDecimal total = BigDecimal.ZERO;

for( Item i : items){

   total = total.add( i.amount);

}

 

Map<String, Object> param : new HashMap<>();

param.put("amount", total);

final JasperPrint print = JasperFillManager.fillReport(report, param, source);

 

// Export the report to a PDF file.

JasperExportManager.exportReportToPdfStream(print, out);

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...