0

我正在尝试将 ${SubLocationId} 参数传递给 Pentaho 报告中使用的查询,如下所示

SELECT
    UTD.Vehicle,
    UTD.Location,
    UTD.SubLocation,
    UTD.HourCreated,
    UTD.VehicleId,
    UTD.SensorPosition,
    (SELECT Pressure FROM DailyTyreData WHERE Created = UTD.Created AND VehicleId =         UTD.VehicleId AND UTD.SensorPosition = SensorPosition) AS Pressure,
    (SELECT Temperature FROM DailyTyreData WHERE Created = UTD.Created AND VehicleId = UTD.VehicleId AND UTD.SensorPosition = SensorPosition) AS Temperature
FROM
    (SELECT
        DTD.ExternalReference AS Vehicle,
        DTD.Location,
        DTD.SubLocation,
        DTD.HourCreated,
        DTD.VehicleId,
        DTD.SensorPosition,
        MAX(DTD.Created) AS Created
    FROM 
        DailyTyreData DTD
    WHERE
        DTD.SubLocationId = ${SubLocationId}
    GROUP BY
        DTD.ExternalReference,
        DTD.SubLocation,
        DTD.Location,
        DTD.HourCreated,
        DTD.VehicleId,
        DTD.SensorId,
        DTD.SensorPosition) UTD
ORDER BY
    UTD.Created

尝试预览报告时出现以下错误

org.pentaho.reporting.engine.classic.core.ReportDataFactoryException: Failed at query:

at    org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SimpleSQLReportDataFactory.queryData(SimpleSQLReportDataFactory.java:258)
at org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SQLReportDataFactory.queryData(SQLReportDataFactory.java:171)

该参数已添加到报表设计器参数部分的输入参数中。发生这种情况有什么原因吗?

4

1 回答 1

0

好的,参数按预期传递,但查询未返回任何结果,导致折线图在预览时破坏报告。

于 2013-06-18T14:02:35.477 回答