evalentine Posted April 5, 2010 Share Posted April 5, 2010 I want to take the sums of two columns and add together. The first column is the hours, the second is the minutes. Something like;$V{tot_hours} = (($F{hours} * 60) + $F{minutes} ) / 60) This will equal the total number of hours as a decimal. Then I can multiple by the hourly rate. Any suggestions?Thanks. Link to comment Share on other sites More sharing options...
slow Posted April 6, 2010 Share Posted April 6, 2010 why don't you use a variable for each column you want to sum?you can define:a variable $V{sum_hours} that is the sum of all hours that you have in your report...a variable $V{sum_minutes} that is the sum of all minutes that you have in your report...and then use this variables:$V{tot_hours} = (($V{sum_hours} * 60) + $V{sum_minutes} ) / 60) ________________________________if it works... KARMA point please! : ) Link to comment Share on other sites More sharing options...
evalentine Posted April 6, 2010 Author Share Posted April 6, 2010 In the Expression Editor : (($F{timeproj_h} * 60) + $F{timeproj_m}) / 60Error says * is undefined for the argument type Integer,int.Any suggestions?Thanks. Link to comment Share on other sites More sharing options...
slow Posted April 7, 2010 Share Posted April 7, 2010 use the intValue() when you want the int from an Integer... so:define $V{tot_hours} as Integerand set the expression as: new Integer((($V{sum_hours}.intValue() * 60) + $V{sum_minutes}.intValue() ) / 60)if you want use with integer values...if you prefer double or float value use Float or Double types...read this for basic usage of the primitive wrapper java class:http://en.wikipedia.org/wiki/Primitive_wrapper_class ______________________________if it works... KARMA point please! : ) Post Edited by slow at 04/07/2010 07:16 Link to comment Share on other sites More sharing options...
evalentine Posted April 7, 2010 Author Share Posted April 7, 2010 I am still not getting this correct.The variables are defined as java.lang.Integer.If I use:((($V{timeproj_h_2}.intValue() * (60)) + $V{timeproj_m_2}.intValue() ) / (60))I get cannot cast int to integer.If I use:((($V{timeproj_h_2} * (60)) + $V{timeproj_m_2}) / (60))I get :* is undefined for the argument type Integer,int. I seem to be lost in Value Type Hell. Any suggestions to explain this or just get around it?Thanks. Link to comment Share on other sites More sharing options...
slow Posted April 8, 2010 Share Posted April 8, 2010 if you read better my last post :new Integer((($V{sum_hours}.intValue() * 60) + $V{sum_minutes}.intValue() ) / 60)you MUST create a new Integer value... it's only JAVA rule! :) ______________________________if it works... KARMA point please! : ) Link to comment Share on other sites More sharing options...
evalentine Posted April 8, 2010 Author Share Posted April 8, 2010 My ignorance is showing. I will need to get much more into Java than I thought I would.Your answer solved the problem.Much 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