Jump to content
Changes to the Jaspersoft community edition download ×

string to float; carry over sums


Recommended Posts

Hello out there,


after reading through the forum and trying some solutions, i m still stuck and would like to get some help.


The goal is summing up the field $F{gpreis}, which is a String field during a page and give this "transfer sum" within the footer of the report. The main report contains subreports, where the field $F{gpreis} is printed (detail band).


Problems are:


1.) Changing a number in a string field to a double or float;the solution


new Double( $F{gpreis}.parseDouble() ) resulted in


1. The method parseDouble() is undefined for the type String

value = (java.lang.Double)(new Double(((java.lang.String)field_gpreis.getValue()).parseDouble()));


2.) after having the number (gpreis) within a variable i would like to sum this variable up (in a subreport) and print the value at the end of each page (transfer value within an invoice).


Thank you very much for help




Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi, Check if your field (gpreis) is declared as Class String. By the error that it's giving to you I'm suspect that is declared as a number (Integer or Double).


Anyway I believe that it's better if declared as a number, since you want to sum it. To do the sum declare other variable with "Calculation Type" set to "Sum" and "Variable Expresion" to $F{gpreis}. You must put the reset type according to your needs, "page" in your case if I didn't misunderstood you.



Link to comment
Share on other sites

Thank you for your help,


the second point is solved by using the "last page footer" (nice thing.


The first point was solved in giving the carry over with each detail data.


The solutions were according to the data aquisition system which is a standard within the erp system (abas) i'm using.




Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...