This simple report takes in an integer date from the user in the format of yyyyMMdd and converts it into a date of format yyyy-MM-dd to be used in a query to limit the dataSet by date.<br />
<br />
The script in the beforeOpen method of the dataSet is what does everything. First, a simpleDateFormat is created for yyyy-MM-dd. Then, the year, month, and date values are separated from the parameter into their own variables. A new date is then created and formatted using the format above. It is then added in a where clause to the queryText to limit the dataSet. The code used is below.
df = new Packages.java.text.SimpleDateFormat("yyyy-MM-dd");
year = parseInt(params["IntegerDate"].toString().substr(0,4));
month = parseInt(params["IntegerDate"].toString().substr(4,2))-1;
day = parseInt(params["IntegerDate"].toString().substr(6,2));
newDate = new Date(year,month,day);
newDate = df.format(newDate);
this.queryText = this.queryText + " where CLASSICMODELS.ORDERS.ORDERDATE < '" + newDate + "'";
<br />
The example attached was created in BIRT 2.5.2.