Jump to content
Changes to the Jaspersoft community edition download ×

How do I fix an error in subreports?


ml.francis

Recommended Posts

Hi, good day, I'm trying to create a simple product catalog, this is my first time to create a subreport and I followed the tutorial and customized it for the products... basically I just have a main report with a subreport to display the description of the product. the main report has a field called ID_product that draws from the table the ID of the given product and the subreport should use that to query for a field it has called 'description'. The report should show a list of products starting with the ID and then display a description of that product in the subreport. I didn't want to just display it without subreports because i wanted to further design the report to look like a card like format for each product with a picture of the product and other technical details, so the screen should display a full description of one product and then move on to the next product and so on...

my main report has an ID_product field from tbl_product in the details band... then I created a subreport, deleted the unused bands and then used this syntax as the query:

select description
from tbl_product
where tbl_product.ID_product = $P{ID_product}
 
the subreport has a static label (Description: ) on the column header band then I put in the details band the field description (it displays $F{description}).
then afterwards I inserted this subreport in the main report under the ID_product field inside the details band. following the instructions of the tutorial of subreports, I tried adding a parameter, double-clicked the ID_employee. I previewed the main report then it generated an error that it couldn't find the (subreport).jasper file, so I checked the properties tab of the subreport and noticed that the Expression field doesn't display the same value as the one I chose in the parameters so I modified it and it now displays $F after double-clicking the ID_product field in the expression editor (it displays $F{ID_product} in the expression editor though...). now, I tried to preview it it shows a different error, about a run time exception error where an Unknown subreport source class java.lang.Integer... did I do something wrong? Thank you and any help would be great.

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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