totalylouco Posted January 17, 2008 Share Posted January 17, 2008 Hello, Im creating a report in IReport 2.0.4, my problem is that I want to pass a param (or create a date) in the sqlQuery Code:SELECT count(*) as value_ FROM SociosApartamentoswhere codModalidade=$P{idModalidade}AND dataInicio)<=$P{data} AND dateadd('d',nDias,dataInicio)>$P{data} But this does not work. I also tried to pass the day month and year and create a string the represents the date but it wasnt sucesful also. Link to comment Share on other sites More sharing options...
itchytoes Posted January 18, 2008 Share Posted January 18, 2008 Hi -- Hmm. What type is that parameter you are passing in? what is the database you are using? If you just pass in a string, do you need to apply a conversion function (like to_date in oracle, or whatever) before you can apply the date functions? Betty Link to comment Share on other sites More sharing options...
justis Posted January 18, 2008 Share Posted January 18, 2008 What do you mean, "it doesn't work"? Does it get no results? Does it create a stack trace? If there are relevant errors or logs, please post them. First thing I'd recommend that you check is that you've set the data type correctly on the parameter. Depending on which RDBMS you are using, you will want Date, Timestamp, or possibly Long. Kind regards,Justis Link to comment Share on other sites More sharing options...
technotrans Posted January 18, 2008 Share Posted January 18, 2008 What you should do:1) just put a formated String in the Parameter map (for instance formatted with SimpleDateForamt)2) use the proprietary conversion-function of your database system that's it. Link to comment Share on other sites More sharing options...
totalylouco Posted January 19, 2008 Author Share Posted January 19, 2008 The database is MS Acess, and im passing a string, Ill try to aply the conversion function.Thanks Link to comment Share on other sites More sharing options...
totalylouco Posted February 4, 2008 Author Share Posted February 4, 2008 This worked. Thanks 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