gobenn71 Posted May 25, 2010 Share Posted May 25, 2010 Hi all, i've got the following problem/challenge :D : In a report, i'm getting a date range with a start date and an end date as fields via a datasource.for instance : StartDate = 2009-10-01EndDate = 2009-10-07 From those 2 valueI now want to dynamically calculate and display all the dates of the days which are included in this date range. The report should display something like : 2009-10-01: .....<some other information>2009-10-02: .....<some other information>2009-10-03: .....<some other information>2009-10-04: .....<some other information>...2009-10-07: ..... .....<some other information> Is there any way to implement this in a JasperReport ? I'd like to add that i don't have groovy available in the production runtime environment. Post Edited by gobenn71 at 05/25/2010 12:36 Link to comment Share on other sites More sharing options...
ldevigne Posted May 25, 2010 Share Posted May 25, 2010 When I had to manipulate dates in iReport, I used the scriptlet class to write some Java functions, which I called in derived parameters... Link to comment Share on other sites More sharing options...
slow Posted May 26, 2010 Share Posted May 26, 2010 you can use a JRDataSourceProvider in java, that creates the data you need passing it to your report or,if you use Oracle (I use it so i suggest this method...) you can create a report that receives two parameter... start date and end date (in yyyymmdd format) with this query: SELECT * FROM( SELECT TRUNC(TO_DATE($P{startdate},'yyyymmdd'),'DD')+ROWNUM -1 DATES FROM ( SELECT 1 FROM Dual GROUP BY CUBE (2, 2, 2, 2, 2, 2, 2,2,2,2) ))WHERE TO_CHAR( DATES, 'yyyymmdd') <= $P{enddate} whit this query you have a list of all days between the two date you want...if you use other DB try to search something similar to create or emulate date generation. _________________________________________if it works... give me KARMA points please! : ) _________________________________________Post Edited by slow at 05/26/2010 08:37 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