2001 JI Open Discussion Posted August 17, 2006 Share Posted August 17, 2006 By: Lecio Nunes - lnunes Problem with variables 2002-11-21 06:15Hi, I'm having problems with variables, I neet to perform calculations over one variable that stores the sum of one field. The sum is shown cumulatively, that is, for each line, is shown the sum of above lines. This is ok, but for each line I have to show the diference of one field and this cumulative sum. Here is where the problem goes on: it shows the diference of the field and the sum calculated for the line above, not for the actual. That is the code for the variables: <variable name="gastoAcumulado" class="java.lang.Double" resetType="Group" resetGroup="GrupoAtividade" calculation="Sum"> <variableExpression>$F{gasto}</variableExpression> <initialValueExpression>new Double(0)</initialValueExpression> </variable> <variable name="saldo" class="java.lang.Double" resetType="None" calculation="System"> <variableExpression>new Double($F{aprovado}.doubleValue() - $V{gastoAcumulado}.doubleValue())</variableExpression> </variable> Any help will be welcome, thanks Lecio By: Teodor Danciu - teodord RE: Problem with variables 2002-11-29 05:10 Hi, This is probably the most complex issue one might encouter using the variables of JasperReports. You can solve your problem only if you use scriptlets to manipulate your data in a custom manner. Or you could help the engine a little by calculating the sum in the SQL query using the MAX() function. I hope this helps. Teodor 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