sanbez Posted January 29, 2013 Share Posted January 29, 2013 How to display row with max summary value in last row? I am using IncrementerFactory implements JRExtendedIncrementerFactory. But I am can't understand how "to say" jasper calculate sum in row (it's realized) and max (with Date of max - it's problem for me) for same measure of crosstab. Any "date" (first column) is java-object with private field java.util.Date and java.lang.Boolean (it "marks" records for calculating maximum).Full report:In last(sum) total row I want to see row with data (instead of row "Max(date, values), etc..."):Any advice greatly appreciated! Link to comment Share on other sites More sharing options...
dprogrammer Posted January 29, 2013 Share Posted January 29, 2013 Hi, If it's possible for you, you can do that in query. If yes, I can post some sample code. Regards, Link to comment Share on other sites More sharing options...
sanbez Posted January 30, 2013 Author Share Posted January 30, 2013 I am use java (ORM) for DataSource (new JRBeanCollectionDataSource(Collection)). I don't use query. And using additional query requred additional time for calculating report. It's not effective. Now I am think that better way is calculating max in java. I will add additional record into DataSource collection with total max. But in this case many data (sum for row? total sum) must be calculated "by hand". And I must add private field in "Date-object" for sorting (to display summary in last row.). It's not effective too :( And formatting summary in row, total summary is more difficult. And power of JR is not using. Only display "pre-calculated" objects... :( Now I'm in a sad meditations :( Link to comment Share on other sites More sharing options...
sanbez Posted February 1, 2013 Author Share Posted February 1, 2013 Problem solved by same steps: 1. Set "None" to display row-summary and column summary 2. Calculate summary for row in java (calculate DataSource collection) 3. Calculate date of max and add row with max to collection (in java). In this row set dateMax = realDateMax+10000 years (It's for display in last row in report) 4. Date expression in jrxml: $V{peakDate}.getDate().getTime()>4000000000000L ? my.package.name.addYear($V{peakDate}.getDate(),-10000) : $V{peakDate}.getDate() (Display correct data in last row) It will be work only before 2096 year. It's enough for me :) 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