Jump to content
We've recently updated our Privacy Statement, available here ×

Filtering between two same date but different time


mehan

Recommended Posts

I'm creating a jasper report which has the parameters of `datetrfrom` and `datetrto`.
The filtering goes well except when the the two parameters carry the same data such as

`datetrfrom>= '15-12-2012'`

`datetrto<= '15-12-2012'`


The data which are processed on the 15-12-2012 will not come out.

I tried this in my JSP :

function ShowReport(){  var param='';                var timestart = ' 00:00:00'  var timeend = ' 23:59:59'  var datetrFrom = document.forms['report']['datetransfrom'].value;  datetrFrom.split("-")     //i split n join back the date to change the format from dd-MM-yyyy to yyyy-MM-dd        var dtf = [datetrFrom[6],datetrFrom[7],datetrFrom[8],datetrFrom[9],datetrFrom[5],datetrFrom[3],datetrFrom[4],datetrFrom[2],datetrFrom[0],datetrFrom[1]].join('')  datetrfr = dtf + timestart; //i join the date with the timestart to create format yyyy-MM-dd hh:mm:ss     var datetrTo = document.forms['report']['datetransto'].value;  datetrTo.split("-")           var dtt = [datetrTo[6],datetrTo[7],datetrTo[8],datetrTo[9],datetrTo[5],datetrTo[3],datetrTo[4],datetrTo[2],datetrTo[0],datetrTo[1]].join('')     datetrto = dtt + timeend; //i join the date with the timeend to create format yyyy-MM-dd hh:mm:ss  param = param + '@@dtTFrom=='+datetrfr+'@@dtTTo=='+datetrto;[/code]


`@@dtTFrom` and `@@dtTTo` are the parameters that I use in my jasper report.

This is what I do in the where clause in my jasper report:

where record_line_status='NO'    and datetime_process >= convert(date, $P{dtTFrom},105)    and datetime_process <= convert(date, $P{dtTTo},105)[/code]

But my report still does not work.. Can anyone help me?

I'm still new to jasper reports. I hope anyone can help me. Thank you in advance.

 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I have solved my problem here.
This is my new coding in my JSP:

function ShowReport(){  var param='';                                                 var timestart = ' 00:00:00'                               var timeend = ' 23:59:59'                                                   var orgFrom = document.forms['report']['org_id'].value;    param = param + 'orgFrom=='+orgFrom;          var datetrFrom = document.forms['report']['datetransfrom'].value;    var datefromsplit = datetrFrom.split('-');    var datefromjoin = [datefromsplit[2], datefromsplit[1], datefromsplit[0]].join('-');    var datefromsend = datefromjoin + timestart;                                   var datetrTo = document.forms['report']['datetransto'].value;    var datetosplit = datetrTo.split('-');    var datetojoin = [datetosplit[2], datetosplit[1], datetosplit[0]].join('-');    var datetosend = datetojoin + timeend;                                   param = param + '@@dtTFrom=='+datefromsend+'@@dtTTo=='+datetosend;[/code]

and this is what I do in the where clause in my jasper report:

where ep_lpp04_temp.record_line_status='No'    and EP_LPP04_TEMP.datetime_process >= convert(datetime, $P{dtTFrom}, 120)    AND EP_LPP04_TEMP.datetime_process <= convert(datetime, $P{dtTTo}, 120)[/code]

by the way my parameter class is java.lang.string.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...