row count

0
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.
kacheek's picture
27
Joined: Nov 8 2006 - 12:02pm
Last seen: 12 years 9 months ago

Another way is to use standard variable $V{COLUMN_COUNT} in text field expression editor EX: "Total items:" + $ V {COLUMN_COUNT}

nandotromp - 1 year 1 day ago

5 Answers:

1
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
jmurray's picture
549
Joined: Dec 11 2006 - 11:19am
Last seen: 12 years 8 months ago
0
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 expression
how can i make it to count from 1 onwards?
kacheek's picture
27
Joined: Nov 8 2006 - 12:02pm
Last seen: 12 years 9 months ago
0
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
jmurray's picture
549
Joined: Dec 11 2006 - 11:19am
Last seen: 12 years 8 months ago
0
oh. i'm sorry as i overlooked the offset part. thanks for the guidance, jmurray. ;)
kacheek's picture
27
Joined: Nov 8 2006 - 12:02pm
Last seen: 12 years 9 months ago
0
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
msnoeck's picture
Joined: Sep 15 2011 - 3:24am
Last seen: 7 years 11 months ago
Feedback
randomness