javydreamercsw Posted August 9, 2006 Share Posted August 9, 2006 I want to display a result based on a Java function, which I'm coding right now, that'll take to fields ($F{Field1} & $F{Field2}) that are dates and get the amount of working days betweem them. How can I make this calculation in the report and post the answer? I'll post the function code when I'm done. Link to comment Share on other sites More sharing options...
javydreamercsw Posted August 9, 2006 Author Share Posted August 9, 2006 javydreamercsw wrote: I'll post the function code when I'm done. Here's the code as promissed): Code: Post edited by: javydreamercsw, at: 2006/08/09 12:50Post edited by: javydreamercsw, at: 2006/08/09 12:51 Link to comment Share on other sites More sharing options...
javydreamercsw Posted August 9, 2006 Author Share Posted August 9, 2006 Here's my closest attempt to use the class from iReport, after adding the jar to the classpath in the textfield expression:Code:And I get the following error: Code:I'm sure is just a mistak in how I invoke the class from iReport. Any help is welcomed! Link to comment Share on other sites More sharing options...
lucianc Posted August 9, 2006 Share Posted August 9, 2006 Spelling/case error: NetWorkDays, should be NetWorkdays. HTH,Lucian Link to comment Share on other sites More sharing options...
javydreamercsw Posted August 9, 2006 Author Share Posted August 9, 2006 Thanks! Can't beleive I missed that :P Link to comment Share on other sites More sharing options...
javydreamercsw Posted August 10, 2006 Author Share Posted August 10, 2006 I managed to pull out the calcualted code thanks to lucianc but found another dilema tha I hope you can help me with.The function works great but I need to calculate de average of it to be displayed in my report. So I've added a sum variable on the field. So I tried to do something like this to get the average:Code:But it gives me errors: Code:How can I get the average?Thanks in advance... Link to comment Share on other sites More sharing options...
kaunietiss Posted August 10, 2006 Share Posted August 10, 2006 try this one:Code: Link to comment Share on other sites More sharing options...
javydreamercsw Posted August 10, 2006 Author Share Posted August 10, 2006 Thanks! It did work! Now I have another issue. I need to return the last value of the formula, which is the real answer to the main report. I've been looking around but the created variable with your formula isn't available as a sub report variable. Any idea? Link to comment Share on other sites More sharing options...
kaunietiss Posted August 10, 2006 Share Posted August 10, 2006 add the new variable which has the expression i've wrote before and pass that variable to the report. I hope that will help. Link to comment Share on other sites More sharing options...
javydreamercsw Posted August 10, 2006 Author Share Posted August 10, 2006 That's exactly what I'm attempting to do. I need to know how I actually pass the variable. Is there an special variable setting? WHere I decide which variable is passed? Because when I try to get the returned value from the main report (subreport Properties/Subreport (Others)/Subreport Return Values) the only available variable in the list are the automatically generated *_Count variables. Link to comment Share on other sites More sharing options...
rajesh Posted August 11, 2006 Share Posted August 11, 2006 use some thing like this for ur problem...... new Long(($V{variable1}.longValue)/($V{variable2}.longValue)) i think this way ur problem will be resolved. Use actual dataType that ur using instead of Long.I think now u can understand what are i am doing.B'coz u can not use division on two objects of Wraper Type. Link to comment Share on other sites More sharing options...
kaunietiss Posted August 11, 2006 Share Posted August 11, 2006 you can add your own variables View -> Variables -> New. Link to comment Share on other sites More sharing options...
javydreamercsw Posted August 11, 2006 Author Share Posted August 11, 2006 I know that, the proble is that the custom variables are not available as variables in the subreport available variable to be used as return variables. (subreport Properties/Subreport (Others)/Subreport Return Values) 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