kacheek Posted December 27, 2006 Share Posted December 27, 2006 I wanna display an incremental number for each Category that is displayed at myGroup band. (in another words, counting the number of myGroup displayed)Eg:1 Category A... Details 2 Category B... Details 3 Category C how can i do so? i tried creating a new variable $V{ROW_COUNTER}, variable class type = java.lang.Integer,calculation type = sum or system, reset type = Group, reset group = myGroup. but the $V{ROW_COUNTER} returns 'null' when executing the report. pls guide. thanks. Link to comment Share on other sites More sharing options...
jmurray Posted December 28, 2006 Share Posted December 28, 2006 Create you new variable ROW_COUNTER as java.lang.Integer with a resetType of "Report", incrementType of "Group" using your group's name for the incrementGroup. The calculation method is "Count". Your variableExpression should be "new java.lang.Integer(1)", and your initialValueExpression will be "new java.lang.Integer(0)". That leaves you with a zero based counter. But you need a 1 based counter, so you have to add an offset in the Text Field that is set up to display the contents of the variable. Set the Text Field Expression to be "new java.lang.Integer($V{ROW_COUNTER}.intValue()+1)" Hope this helps Link to comment Share on other sites More sharing options...
kacheek Posted January 1, 2007 Author Share Posted January 1, 2007 i've manage to get the running number based on the number of group records. however, the number starts from 0. i used new Integer(0) as my field expressionhow can i make it to count from 1 onwards? Link to comment Share on other sites More sharing options...
jmurray Posted January 2, 2007 Share Posted January 2, 2007 As previously stated you have to add an offset in the Text Field that is set up to display the contents of the variable. Set the Text Field Expression to be "new java.lang.Integer(whatever calculation method you use + 1)" Post edited by: jmurray, at: 2007/01/01 22:22 Link to comment Share on other sites More sharing options...
kacheek Posted January 3, 2007 Author Share Posted January 3, 2007 oh. i'm sorry as i overlooked the offset part. thanks for the guidance, jmurray. ;) Link to comment Share on other sites More sharing options...
marcels Posted November 14, 2011 Share Posted November 14, 2011 I am Busy with a report, what display my best selling products per months.It seems that it is more or less the same as requested by Kacheek. Because I am a newby in IReports I try to understand what you mean by the last part.---------That leaves you with a zero based counter. But you need a 1 based counter, so you have to add an offset in the Text Field that is set up to display the contents of the variable. Set the Text Field Expression to be "new java.lang.Integer($V{ROW_COUNTER}.intValue()+1)"---------- I have created an query what tell me how many are sold per month, but i want only to know the top 5. What should I do when the 5 are displayed that the next month is displayed. Thanks for your support best regards Marcel Snoeck Link to comment Share on other sites More sharing options...
nandotromp Posted August 17, 2018 Share Posted August 17, 2018 Another way is to use standard variable $V{COLUMN_COUNT} in text field expression editor EX: "Total items:" + $ V {COLUMN_COUNT} 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