贾斯珀Async报告-空,为什么

Jasper Async Report - Empty, why?

本文关键字:为什么 Async 报告 贾斯珀      更新时间:2023-09-26

让我们开始,首先我为特定的报告获取参数,例如

var config = {
    url : "http://exmaple.com/jasperserver/rest_v2/reports/reportFolder/exampleReport/inputControls",
    method: "GET",
    headers: {
        Accept: "application/json;"
    },
}

一切正常,我得到一个包含输入数组的响应,

数组包含2个对象:

:

{
description: "Date_from",
id: "Date_from",
label: "Date from",
type: "singleValueDate"
}
第二:

{
description: "Date_to",
id: "Date_to",
label: "Date_to",
type: "singleValueDate"
}

两个输入都有一个属性:

validationRules[0].dateTimeFormatValidationRule.format = "yyyy-MM-dd"

现在我想运行一个async报告(现在我将async参数传递false,因为这里的代码更少)

var params ={
    reportUnitUri: "/reportFolder/exampleReport",
    outputFormat: "html",
    freshData : true,
    saveDataSnapshot : false,
    ignorePagination: true,
    async : false,
    interactive: false,
    allowInlineScripts: true,
    parameters: {
        "Date_from":["2014-08-01"],
        "Date_to":["2015-10-08"]
    }
}

现在我尝试生成async报告:

var config = {
        url : "http://exmaple.com/jasperserver/rest_v2/reportExecutions",
        headers: {
            Accept: "application/json"
        },
        data: params,
        method: "POST"
    }

我得到一个成功的响应,但是

totalPages: 0,
requestId: "0200cf28-300f-4e76-b99e-e479be4980ba",
reportURI: "/reportFolder/exampleReport/",
status: "ready",
exports[0].id: "c9a5578a-6bc8-4c3e-8a78-9056ef19f456",
exports[0].status: "ready",
exports[0].outputResource :{
    contentType: "text/html",
    outputFinal: true
}

当我试图通过调用

来获得报告的输出时
 http://exmaple.com/jasperserver/rest_v2/reportExecutions/0200cf28-300f-4e76-b99e-e479be4980ba/exports/c9a5578a-6bc8-4c3e-8a78-9056ef19f456/outputResource

报告为空。

运行同样的通过:

http://exmaple.com/jasperserver/rest_v2/reports/reportFolder/exampleReport.html?Date_from=2014-08-01&Date_to=2015-09-08

给我一个完整的报告,

谁能指出我做错了什么?:/我很确定这可能是参数有问题,但我尝试了各种方法,我无法自己找到解决方案:/

问题是传递给异步报告的参数格式不好,它应该是这样的:

parameters: {
    reportParameter: [
        {name : "Date_from",value : ["2014-08-01"]},
        {name : "Date_to",value : ["2015-10-08"]}
    ]
}