Birt日期和过滤器参数

时间:2015-09-18 23:34:09

标签: mysql report birt

我创建了一个执行以下操作的birt报告

  • 按日期范围过滤报告
  • 按ID过滤报告

两者都有效,但问题是我无法将这2个参数组合成多个报告。

我的代码

today = new Date(); //sample database ends in May 2005
//today = new Date(); //real "today" value if not using sample database
df = new Packages.java.text.SimpleDateFormat("yyyy-MM-dd 00:00:00");
today = df.format(today);

if (params["Date Range"].value == "Custom Range"){
this.queryText = this.queryText + " where smartcomp.service.time_in between '" + params["StartDate"].value + "' and '" + params["EndDate"].value + "'";
}
else{
    if (params["Date Range"].value == "Last 6 Months"){
        rangeStart = DateTimeSpan.subDate(today, 0, 6, 0);
    }
    else if (params["Date Range"].value == "Last 12 Months"){
        rangeStart = DateTimeSpan.subDate(today, 0, 12, 0);
    }
    else{
        rangeStart = DateTimeSpan.subDate(today, 2, 0, 0);
    }


rangeStart = df.format(rangeStart);

this.queryText = this.queryText + " where smartcomp.service.time_in between '" + rangeStart + "' and '" + today + "'"
}


if( params["NewParameter2"].value != "(AllEmployee)" ){

this.queryText = this.queryText + " where employee.employee_id = " + params["NewParameter2"].value
}

P.S。之前答案中的问题(重复原因)是,那个php和这是birt + java,我知道如何在sql中结合where子句但我不知道如何在birt中。

0 个答案:

没有答案