atuin Posted December 5, 2012 Share Posted December 5, 2012 I'm sure this is possible, but I can't find a way to do it. I have many variables who came from sub-reports, defined like this :variable class : integercalculation : systemreset type : noneincrement type : none I want to make a sum for some of these variables, by example : $V{nb1}.plus($V{nb2}).plus($V{nb8}) It works great if I do this into a textfield, but not if I want to put it in a variable (lets call it sum1). property of the variable :variable class : integercalculation : systemreset type : reportincrement type : noneLike this, I obtain the initial value expression. If I set reset type as none, I obtain null. The textfield containing my variable sum1 is at "evaluation time : report" So, my variable sum1 is calculated before nb1,nb2 and nb8 are. I don't know what to do next... Can somebody help me? Link to comment Share on other sites More sharing options...
rubamushtaq Posted December 6, 2012 Share Posted December 6, 2012 Hi, You can easily take sum of one variable into another variable like take a varible of name "Sum" with following specifications.Name: SumVariable class: IntegerCalculation : NothingReset Type: ReportIncerement Type : NoneVariable Expression : $V{nb1}+($V{nb2}) + $V{nb8}) I hope that may resolve your problem. Link to comment Share on other sites More sharing options...
atuin Posted December 6, 2012 Author Share Posted December 6, 2012 Hi, thanks for your reply, unfortunately, I still obtain null. Link to comment Share on other sites More sharing options...
rubamushtaq Posted December 6, 2012 Share Posted December 6, 2012 Then take a text field and set text field expression "Sum"(your variable) and set the text field evaluation time. Link to comment Share on other sites More sharing options...
atuin Posted December 6, 2012 Author Share Posted December 6, 2012 ... I'm not sure if I don't understand you, or if you tell me to do what I already did : "The textfield containing my variable sum1 is at "evaluation time : report" Of course I tried every possible evaluation time! Link to comment Share on other sites More sharing options...
rubamushtaq Posted December 6, 2012 Share Posted December 6, 2012 You are right you have already done it,I could not remember it.Anyhow the solution is working fine as I run it. I would recommend you to check the classes of your variables and make sure that they all are types of integer and also make sure that you have not coming null values in it from the database. Beacuse the above specifiatons should work when the correct data is present. 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