当date作为参数传递时,node-prd集成无法正常工作

时间:2018-06-18 05:11:51

标签: node.js postgresql pentaho

我正在尝试将我的节点应用程序与prd文件集成。为此,我需要将三个参数传递给它。当我尝试传递start dateend date作为参数时,我得到一个空白的pdf页面作为输出

router.post('/executeReport', function(req, res) {
    if (req.headers && req.headers.authorization) {
        var authorization = req.headers.authorization.substring(4),
            decoded;
        decoded = jwt.verify(authorization, Config.secret);
        req.body = req.body.params
        sdate = new Date("1998-01-01");
        edate = new Date("2018-06-30");
        startTimeStamp = sdate.getTime() / 1000;
        endTimeStamp = edate.getTime() / 1000;
        var nPrd = nodePrd.createInstance({
            reportBundlePath: "/home/jooshifa/Desktop/COPYtoLINUX/taskit/report-templates/reea.prpt",
            outputFilePath: path.resolve("/home/jooshifa/Desktop/COPYtoLINUX/taskit/out/report/samplenew3"),
            outputType: "pdf",
            params: [{
                name: "user",
                value: "120",
                type: "Integer"
            }, {
                name: "start_date",
                value: startTimeStamp,
                type: "Date"
            }, {
                name: "end_date",
                value: endTimeStamp,
                type: "Date"
            }]
        }, {
            prdHomePath: '/home/jooshifa/Desktop/COPYtoLINUX/report-designer',
            tmpParentFolder: __dirname
        });
        nPrd.initRaaS(3333, true, true);
        console.log('Running report...');
        //END

        //Run report
        nPrd.runReport(function(code) {
            console.log("CODE", code)
            if (code == 0) {
                console.log("Report OK");
            } else {
                console.log("Report ERROR=" + code);
            }

        }, false, true);

    } else {
        return res.status(401).send('Invalid User');
    }
});

我在Pentaho报表设计器中的查询是

SELECT "logs"."createdAt",userp.f_name,logs.action
    FROM public.tbl_logs as logs LEFT JOIN public.tbl_user_profiles as userp ON (logs.user_profile_id = userp.id) WHERE (logs.user_profile_id = ${user} AND ("logs"."createdAt" BETWEEN ${start_date} AND ${end_date}))
是的,有人可以帮我吗?

0 个答案:

没有答案