How to create line number (iReport)
im using iReport 3.5.2. I want to line number in group band. for example, 1. 1. 2. 2.
1. 开发者_开发技巧 2.ive tried using variables that have provided but it seems to appear not in arcodingly. It appear random number. Please, help me...
You should create 2 variables, one to count the group and the other to count the record within the group.
The first variable is created automatically by iReport for you and it will be named 'groupName_COUNT'
The second variable should count the record id or similar and reset every time the group restarts. Example:
Name: recordCount
Variable class: java.lang.Long
Reset type: Group
Reset group: groupName
Increment type: none
Variable expression: $F{recordIdField}
Finally, to show your field number you could do something like $V{groupName_COUNT}+"."+$V{recordCount}
e.g. if there is a field named "users" and there is a group named "group_users"
<variable name="TotalUsers" class="java.lang.Integer" resetType="Group" resetGroup="group_users" calculation="Count">
<variableExpression><![CDATA[$F{users}]]></variableExpression>
</variable>
<textField evaluationTime="Group" evaluationGroup="group_users">
<textElement/>
<textFieldExpression><![CDATA[$V{TotalUsers}]]></textFieldExpression>
</textField>
精彩评论