Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in Jasper Report: increment on count

 
Sulaiman Malik
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a report fetching a record teacher name from database and generating serial# against it. i have applied a group on teacher name and pass the serial# and teacher name on group header. for serial# number i have created a variable.

<variable name="sr" class="java.lang.Integer" incrementGroup="teacher" incrementType="Group" calculation="Count">
<variableExpression>$V{sr}</variableExpression>
<initialValueExpression>new Integer(1)</initialValueExpression>
</variable>

///////For group on teacher/////
<group name="teacher">
<groupExpression><![CDATA[$F{TCHR_NME}]]></groupExpression>
<groupHeader>
<band height="21">
<rectangle>
<reportElement x="0" y="0" width="29" height="21" forecolor="#666666"/>
</rectangle>
<textField>
<reportElement x="0" y="0" width="29" height="21"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="7"/>
</textElement>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{sr}]]></textFieldExpression>
</textField>
<rectangle>
<reportElement x="29" y="0" width="524" height="21" forecolor="#666666"/>
</rectangle>
<textField>
<reportElement x="29" y="0" width="130" height="21"/>
<textElement verticalAlignment="Middle">
<font size="7"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{TCHR_NME}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
Now the problem is. it display the output like.
Sr#|Teacher
1 A
1 B
2 C
3 D
4 E

why 1 is occurring 2 times, either it has to show like 1,2,3,4 like a counting.....Please Help...Any help will be highly appreciated..A B C D E are teacher names.Thanks
 
praneel shah
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no need to do all this thing.....put a jrxml in a specified folder and then call a method from the action class with a condition specified for that particular report if any parameter for the report is mentioned in it...
 
Sulaiman Malik
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks praneel for the solution, but i have got the solution by giving the evaluationTime="Group" and evaluationGroup on the textField and now it is working fine. Thanks once again.
 
raja kumaran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use variable in jasper ex: ( Report_count, page count,Column count )
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic