cdavis74 Posted February 1, 2011 Share Posted February 1, 2011 Hello,I am new to iReport, and I am writing my first report. I have infomration in the report and it looks great. What I would like to do is to use a date range in my report. I would like to select product sales between the begining and end of the month. I was trying to create a parameter with no luck. Can anyone get me going on the right track to fix this. Thanks.Carla Link to comment Share on other sites More sharing options...
notrolls Posted February 1, 2011 Share Posted February 1, 2011 Welcome to jasper Forums cdavis74, this is my first post too :)What you need to do is to do it in SQL LEARN TO GOOGLE: SQL DATE IN BETWEEN ordatefrom=><= dateto + karma is appreciated ^^ Post Edited by notrolls at 02/01/2011 06:14 Link to comment Share on other sites More sharing options...
adik2dmax666 Posted February 1, 2011 Share Posted February 1, 2011 if the dates are formatted as unix you can also use FROM_UNIXTIME($P{date_parameter},'%Y-%m-%d') and use SQL BETWEEN or operands such as >= <= to sort reports according to dates. Link to comment Share on other sites More sharing options...
cdavis74 Posted February 1, 2011 Author Share Posted February 1, 2011 Thanks for the suggestion. I have a parameter that I am trying to make and this is the query I have: SELECT * FROM `table` table WHERE $F{db_field}BETWEEN '2001-01-01' AND '2011-01-31' I'm not sure what I am doing wrong. I think the problem could be that in the database the fields are not a date types, so in ireports the java.util.date doesn't work, and it seems like it needs to be a java.lang.string. All to say I don't know if the unix string date idea would work. Any suggestions would be great. Thanks again. Link to comment Share on other sites More sharing options...
notrolls Posted February 1, 2011 Share Posted February 1, 2011 unix time will not fail you :) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now