Main Report Connecting with Subreport - Subreport now Showing

0

I have a report with a subreport included.  However, the subreport is not showing when run from the main report.  It does show data when run alone.  When I run the main report, the subreports only shows the No Detail section.

Main report parameters: FiscalYear, Emp_ID, Supervisor_ID, Run_By_HR, SUBREPORT_DIR (this is the parameter that is used to connect to the subreport)

Subreport paramters: FiscalYear, EMP_ID

In the subreport properties of the main report, I am passing both FiscalYear and Emp_ID parameters.  Am I missing something to where the subreport is not pulling any data? 

 

justin.watts's picture
Joined: Jul 16 2015 - 5:35am
Last seen: 10 months 2 weeks ago

Description should read subreport NOT showing.

justin.watts - 1 year 11 months ago

4 Answers:

0

Give some more info please. 
You developing in studio or builing and compiling report through jasper report libs via custom code ? 

There are a lot of stuff you need to touble shoot first. 
So confirm that parameters are being passed over correctly form main to subreport. 
So set subreport to print all  all setcion no detial and then in the suberpot set the parameters in text boxes in a title/header/summary band and run main and see of the parameters are being passed over correctly. Take not if you set default values in the subreport parameters, they will print but the values selected in main report should overwite the default values, otherwise it not being passed over correctly. 

If they are being passed over correctly, you need to test the sql again, might not be returing rows.  
Also ensure the subreport is not being hidden, or px size is to small based on band size. 

Also the first time you run the subreport with the main, the subreport file name reference in your path to subreport would be the .jrxml, there after you need to reference the .jasper and not the jrxml, otherwise the change to subreport never updates. Would be recommended to compile the subreport after saving. 
I some instance I needed to restart the studio as it seems that the subreport was cached in memory for a period of time. (but this rarely happend)

 

joseng62's picture
734
Joined: Dec 5 2014 - 2:43am
Last seen: 3 days 3 hours ago
0

I am building and compiling through jasper report.

When I set to print all sections no detail in the subreport and run from the main report, none of the sections show for the subreport.  I'm guessing that means I'm not passign the parameters correctly, as the sql itself is producing results.  However, I'm not sure else how to pass them.  Is it possible that I need to add more parameters to link the reports?

I tried running with the reference to .jrxml and .jasper and neither one worked.

 

justin.watts's picture
Joined: Jul 16 2015 - 5:35am
Last seen: 10 months 2 weeks ago
0

There is some trickery involved when working with subreport, making changes, then saving, then making sure the .jasper is being run and that it is updated. 

So I would first suggest, maybe just use a table to test parameters with. Easier to use than subreport and there are no table paths or .jasper reports to be consider about. 
Creating and passing parameter are same principle as subrepot and query as well. You can then create a same parameter in main and table dataset, then link parameters. Add parameter to text field in either on of rows or header, then troubleshoot until you get the parameters logic working and you feel confident about it. 

Then apply same logic to subreport. Leave table report there for test and confirm purpose. Remember to add table element a band than only create one element based on sql query return results. i.e. do not put table element in detail band, it will produce multiple tables based on your main report rows returned from sql. So rather add to summary band or foot etc. 

The aim of exercise is start eliminating possible issues. So if you get the parameter working correctly, at least you know it is not that and you can move on to figuring out what else it could be.

joseng62's picture
734
Joined: Dec 5 2014 - 2:43am
Last seen: 3 days 3 hours ago
0

Finally figured this out.  You were correct: I wasn't passing the parameters correctly.  Once I figured that out, everything worked fine.  Thanks for your help!

justin.watts's picture
Joined: Jul 16 2015 - 5:35am
Last seen: 10 months 2 weeks ago
Feedback