将参数传递给pentaho报表查询时出错

时间:2013-06-17 11:35:41

标签: sql pentaho

我正在尝试将$ {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)

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

1 个答案:

答案 0 :(得分:0)

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