rajaniandroid2012 Posted January 21, 2013 Share Posted January 21, 2013 I have created a report in jasper ireport which will find timedifference and the sum of all timedifferences for below table. am getting the output for timedifference. But facing problem when trying to find sum of that .I have used grandtotaling concept where i created a variable 'total' passed the time difference expression 'TimeDiff(updateddatetime,createdtime)' in that ,also created a textbox and called the variable 'total' in that . In the preview instead of sum ,iam getting only last value (timediff in this eg:4:17:00) of the table. . am expecting output as total difference =15:46:00 . Please help me Link to comment Share on other sites More sharing options...
mrcaffeine Posted January 21, 2013 Share Posted January 21, 2013 please attach the JRXML. Also, to make sure that I understand you correctly - the last column should contain the total instead of the current difference? Link to comment Share on other sites More sharing options...
rajaniandroid2012 Posted January 21, 2013 Author Share Posted January 21, 2013 i have attached the file , i want two result in single output, 1. calulating timediff with createdtime and updateddatetime, which am getting the result. 2. total timedifference , which am not getting Link to comment Share on other sites More sharing options...
mrcaffeine Posted January 21, 2013 Share Posted January 21, 2013 In the last table column you configured as text field expression $F{timediff(updateddateTime,CreatedTime)}, if I understand your requirement correctly, it should be $V{total} instead. This would aggregate the seconds, you'd need to modify the formatting so that you get the desired output. There might be a more elegant way, however this seems to work:new SimpleDateFormat("HH:mm:ss").format(new Date((long)($V{total}*1000-TimeZone.getDefault().getOffset($V{total})))) Link to comment Share on other sites More sharing options...
rajaniandroid2012 Posted January 24, 2013 Author Share Posted January 24, 2013 But in the last Column it should calculate the time diff between createdDate and updatedDateTime,so I have used $F{timediff(updateddateTime,CreatedTime)}.but along with this I have to get the sum of all timediff and display in summary band, for which am unable to do.can you please guide me . Link to comment Share on other sites More sharing options...
mrcaffeine Posted January 24, 2013 Share Posted January 24, 2013 what is the output if you add "new SimpleDateFormat("HH:mm:ss").format(new Date((long)($V{total}*1000-TimeZone.getDefault().getOffset($V{total}))))" in the summary band? Link to comment Share on other sites More sharing options...
rajaniandroid2012 Posted January 25, 2013 Author Share Posted January 25, 2013 It is showing 00:00:00, also I have a doubt currently the data type of 'createdtime','updateddatetime','timediff' and 'total time diff' in 'string' format, but variable 'total' is in 'long' format... any thing to be changed in datatype.. the table i have provided is output of the report.along with the column 'timediff', i have to print sum of 'timediff' in summary band.please suggest Link to comment Share on other sites More sharing options...
gsingal Posted March 5, 2014 Share Posted March 5, 2014 Hi All,Any sollution of the above problem.I am also facing the same issue.Thanks,Gaurav 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