0

I am new to iReport and all I have done so far is simply run an already compiled report. In fact it's a report that we are currently using so there should not be any issue. Though, when ever I run the report I get thrown this error message

  Compiling to file... C:\Program Files\Fishbowl\reports\Custom\PackingListTacticalMedical2015.jasper
  Compiling subreports....
  Subreport C:\Program Files\Fishbowl\reports\Custom\SOPackingListTacticalMedical2015.jrxml already compiled.
  **Unable to locate the subreport with expression: "$P{cbLayoutFormat}.equals("standard") ? $P{path} + "POPackingList.jasper" : $P{cbLayoutFormat}.equals("carton") ? $P{path} + "cartonPOPackingList.jasper" : $P{path} + "POPackingListLoc.jasper"".**
  Compilation running time: 13,619

The report does still run and compile but when ever I am prompted to "Enter a shipID" - and I do- the results are blank. I know what the message is saying, I just simply do not understand what it means.

Thanks to anyone that can help with instructions or explanations on this.

Alex K
  • 22,315
  • 19
  • 108
  • 236
colt
  • 116
  • 12
  • Possible duplicate of [How to pass main report data source to subreport (JasperReports)?](http://stackoverflow.com/questions/8490563/how-to-pass-main-report-data-source-to-subreport-jasperreports) – Alex K Oct 22 '16 at 19:15

2 Answers2

0

Try to change expression datatype of your subreports to InputStream instead of String (path), and then passe your subreport as input stream as a parameter. Put your subreport in the resources dir. and compile it.

InputStream subReportStream=getClass().getResourceAsStream("subReportName.jasper");

 params.put("SUBREPORT_STREAM", subReportStream);

this work fine for me.
kamel2005
  • 459
  • 3
  • 13
  • I believe i solved this issue by choosing a different directory.Though now my code is giving me this error message: Error filling print... Error preparing statement for executing the report query :  SELECT ship.id AS ShipID, ship.orderid AS OrderID, ship.ordertypeid AS OrderType FROM ship WHERE ship.id = ? – colt Sep 24 '15 at 17:56
  • it seems your sql string contains an syntax error. try this WHERE ship.id=:? – kamel2005 Sep 24 '15 at 19:36
  • i have WHERE ship.id = $p{shipID} in the main report and all subreports :/ – colt Sep 24 '15 at 19:42
  • 1
    if your shipID dataType is string you mut use ' ' – kamel2005 Sep 25 '15 at 01:14
0

With the way Fishbowl inserts it's run path into the $P{path} parameter you need turn off the compile subreports option when compiling and making changes to the the report. Also with the manner in which Fishbowl overrides the parameters at runtime you'd have to know all of the database ID's you're looking for if you want to run it from within iReport instead of inside Fishbowl. The easiest work around for this is to have the reports compile to the their working directory and you can refresh inside Fishbowl as you compile changes to the reports.

Mamof
  • 181
  • 5
  • 13