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

jeroeng

Members
  • Posts

    1
  • Joined

  • Last visited

jeroeng's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi all, I have the requirement to build a report with several subreports which are all based on .csv files. All reports (main and sub's) are working individually as required, but I can't manage to work the sub reports into the main report. Sources: customer.csv => contains customer name and some more information. name, address, billing infoserver.csv => contains customer name, server IP and more information. fqdn, ip, customer, type, purposeMy master report is based on the customer.csv and reports name of all customers in the file. Below each customer name I want to see all servers we manage for this customer, so customers Name is the linking field. Customer-1 server-1 10.10.10.1 server-2 10.10.10.2 Customer-2 server-a 192.168.1.1 server-b 192.168.1.2Steps I took creating the subreport in the main report: Field name (= customer name) is in the "Detail 1" band of the main report.Drag the subreport element in the "Detail 2" band of the main reportSelect the correct subreport (Server.jxml) which converts automatically to "Server.jasper"Select no datasourceEdit the parameters to have the field Name from the main report be put in parameter Customer in the subreport ($F{Name}Select the subreport and modify the properties:Data Source Expression set to the location of the server.csv ("C:\Users\jeroen_g\xxxxx\Assets_report\server.csv"Running the master report in preview gives the following error: net.sf.jasperreports.engine.JRException: java.lang.ClassCastException: class java.lang.String cannot be cast to class net.sf.jasperreports.engine.JRDataSource (java.lang.String is in module java.base of loader 'bootstrap'; net.sf.jasperreports.engine.JRDataSource is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @484b5a21) at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:551) at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$18(ReportController.java:526) at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:444) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class net.sf.jasperreports.engine.JRDataSource (java.lang.String is in module java.base of loader 'bootstrap'; net.sf.jasperreports.engine.JRDataSource is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @484b5a21) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:529) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:357) at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:383) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:548) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2600) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:825) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:266) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:621) at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135) at java.base/java.lang.Thread.run(Unknown Source) Most likely I'm just missing a small piece here, but have been googling and experimenting for almost a day without success. Hope somebody can direct me in the correct way. Thanks, Jeroen -
×
×
  • Create New...