Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
date range
Eqa
hey i am new to Birt .I want to display record including from and to date range.I am using Mysql database .I have used the following format.But it is not working Can u help on this?
I am giving yyyy-MM-dd as input string .if(params["From"].value!=null && params["To"].value!=null)
{
from1 = new Packages.java.text.SimpleDateFormat("yyyy-MM-dd");
fromdate=new Packages.java.util.Date();
fromdate = from1.parse(params["From"].value);
from2 = new Packages.java.text.SimpleDateFormat("yyyy-MM-dd");
from2.format(fromdate);
to1 = new Packages.java.text.SimpleDateFormat("yyyy-MM-dd");
todate=new Packages.java.util.Date();
todate = to1.parse(params["From"].value);
to2 = new Packages.java.text.SimpleDateFormat("yyyy-MM-dd");
to2.format(todate);
this.queryText = this.queryText + " and DATE(created_on) >= '"+from2.format(fromdate)+"' and DATE(created_on) <= '"+to2.format(todate)+"'";
}
I have attached my file
Find more posts tagged with
Comments
Hans_vd
Hi Eqa,
In the end you are still comparing date values to string values.
Why don't you just bind the report parameters to dataset parameters? That should work without any need for scripting.
vijay_kota
Hey,
You can use below peice of code if your using maximo
if(params["ETAST"].value)
{
start_dt = MXReportSqlFormat.getStartDayTimestampFunction(params["ETAST"]);
}
if(params["ETAEND"].value)
{
end_dt = MXReportSqlFormat.getEndDayTimestampFunction(params["ETAEND"])
}
in your query append start_dt and end_dt
Example:
this.queryText = this.queryText + " and DATE(created_on) between "+start_dt+" and "+end_dt+""
Try this, let me know the result
Regards,
Vijay
jverly01
Some of the reporting functionality in BIRT, at least the versions supplied by IBM for use in Maximo, are scripted for DB2, SQL Server, and Oracle.
Are you sure you're running Maximo on a MySQL database?