【问题标题】:Why is iReport throwing me these subreport exceptions?为什么 iReport 向我抛出这些子报表异常?
【发布时间】:2015-12-22 06:34:36
【问题描述】:

我是 iReport 的新手,到目前为止我所做的只是运行一个已经编译的报告。事实上,这是我们目前正在使用的报告,所以应该没有任何问题。但是,当我运行报告时,我会收到此错误消息

  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

报告仍在运行和编译,但是当我被提示“输入 shipID”时 - 我确实这样做了 - 结果是空白的。我知道消息在说什么,我只是不明白它的意思。

感谢任何可以提供相关说明或解释的人。

【问题讨论】:

标签: jasper-reports subreport


【解决方案1】:

尝试将子报表的表达式数据类型更改为 InputStream 而不是 String(路径),然后将子报表作为输入流作为参数传递。 将您的子报告放在资源目录中。并编译它。

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

 params.put("SUBREPORT_STREAM", subReportStream);

this work fine for me.

【讨论】:

  • 我相信我通过选择不同的目录解决了这个问题。虽然现在我的代码给了我这个错误消息:错误填充打印...错误准备执行报告查询的语句:SELECT ship.id AS ShipID, ship.orderid AS OrderID, ship.ordertypeid AS OrderType FROM ship WHERE ship.id = ?
  • 您的 sql 字符串似乎包含语法错误。试试这个 WHERE ship.id=:?
  • 我在主报告和所有子报告中有 WHERE ship.id = $p{shipID} :/
  • 如果您的 shipID 数据类型是字符串,您必须使用 ' '
【解决方案2】:

使用 Fishbowl 将其运行路径插入 $P{path} 参数的方式,您需要在编译和更改报表时关闭编译子报表选项。此外,对于 Fishbowl 在运行时覆盖参数的方式,如果您想从 iReport 而不是 Fishbowl 内部运行它,您必须知道您正在寻找的所有数据库 ID。 最简单的解决方法是将报告编译到它们的工作目录中,您可以在编译对报告的更改时在 Fishbowl 内部刷新。

【讨论】:

    猜你喜欢
    • 2014-04-22
    • 1970-01-01
    • 2015-05-23
    • 2014-07-09
    • 2015-12-24
    • 2017-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多