Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Problem in Jasper Report: increment on count

 
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
 
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.
 
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 )
 
crispy bacon. crispy tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!