Jump to content
Changes to the Jaspersoft community edition download ×

row count


kacheek

Recommended Posts

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

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

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

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

  • 4 years later...

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

  • 6 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...