ajith.devendra Posted July 11, 2018 Share Posted July 11, 2018 I have two variables TotalPcs ROW_COUNT I want to initialize ROW_COUNT to zero if the variable $V{TotalPcs}>100 Variable ROW_COUNT is defined as below and It’s having an expression , but expression doesn’t initialize the ROW_COUNT .. It continues increasing by one . Would you pls helpw me on this Name = ROW_COUNT Calculation = No Calculation function Expression = (($V{TotalPcs})>100) ? 0 :(new Integer($V{ROW_COUNT}.intValue() + 1)) Increment Type = None Reset type = Report Rgds Ajith Link to comment Share on other sites More sharing options...
joseng62 Posted July 12, 2018 Share Posted July 12, 2018 Quite an interesting one. I tried a couple of combinations with create another variable and playing around with the Calculation set type, the increment set type and the Reset set type. Could not get the result you desired. The initial value expression would initialize based on the value you want, but that only gets executed as many times based on your increment and reset type and there is not expression to be use to manage this.You have 2 options that I could think of:1) To write a custom.jar that has a method that you can instantiate as a variable or in the text field box, where you pass the report count and your method return the last 2 number of the number. So if 10 return 10 if 99 return 99 when passed 100 return 100. 110 it will return 10 1110 it will return 10 2000 would be 100etc. You will have to get the logic right, but that is up to you. Option 2Create a dummygroup in my case Group1. You can just add header. Make it 1 px in size.Create new variable called ‘variable_1’ in my setup.value class ; java.lang.Integercalculation ; CountExpression ; $V{REPORT_COUNT} != 0 ? 1 : 0Initial value Expression ; 0Increment type ; NoneReset type ; [Group] Group1Then select the Group1 Header and in the Expression use$V{Variable_1} == 100So now your variable_1 will increment to 100 and then reset type is Group, so variable_1 will be reset to 0.So $V{REPORT_COUNT} will continue with the standard row count, but variable_1 will count to 100 and reset to 0 and then start to count to 100 again.Best of luck.If anyone out there with better idea, please share. Link to comment Share on other sites More sharing options...
ajith.devendra Posted July 15, 2018 Author Share Posted July 15, 2018 Thanks Joseng , i will try the second option and let you know the outcome RgdsAjith 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