动态报告参数

时间:2014-02-07 11:27:14

标签: javascript birt

这份报告现在已经开始工作了但是在params [“select month”]我静静地给了jan 2012,feb 2012..etc so in before open我写了脚本,提到像selectedDate = new Date(2012,params["select month"] - 1, 1); ...现在它可以通过动态改变它...如果年份变化,params["select month"]必须改变如何做到这一点,有人可以帮助解决这个问题吗?

mysql:
    SELECT
    YEAR (CLASSICMODELS.PAYMENTS.PAYMENTDATE) AS YEARNUMBER,
    MONTH (CLASSICMODELS.PAYMENTS.PAYMENTDATE) AS MONNUMBER,
    SUM (CLASSICMODELS.PAYMENTS.AMOUNT) AS MONTOTAL
    FROM 
    CLASSICMODELS.PAYMENTS
    WHERE 
    (YEAR(CLASSICMODELS.PAYMENTS.PAYMENTDATE) = p11
    AND MONTH(CLASSICMODELS.PAYMENTS.PAYMENTDATE) = p12)
    OR
    (YEAR(CLASSICMODELS.PAYMENTS.PAYMENTDATE) = p21
    AND MONTH(CLASSICMODELS.PAYMENTS.PAYMENTDATE) = p22)
    GROUP BY 
    YEAR (CLASSICMODELS.PAYMENTS.PAYMENTDATE),
    MONTH (CLASSICMODELS.PAYMENTS.PAYMENTDATE)
    ORDER BY 1,2

在数据集之前打开方法:

selectedDate = new Date(2012,params["select month"] - 1, 1);
if(params["period"] == "last month")
{
    pastDate = new Date(2012,params["select month"] - 2, 1);
}
else
{
    pastDate = new Date(2011,params["select month"] - 1, 1);
}

this.queryText = this.queryText.replace("p11","2012");
this.queryText = this.queryText.replace("p12",params["select month"].toString());
this.queryText = this.queryText.replace("p21",BirtDateTime.year(pastDate).toString());
this.queryText = this.queryText.replace("p22",BirtDateTime.month(pastDate).toString());

0 个答案:

没有答案