This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Problem in Jasper Report: increment on count Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Problem in Jasper Report: increment on count" Watch "Problem in Jasper Report: increment on count" New topic
Author

Problem in Jasper Report: increment on count

Sulaiman Malik
Greenhorn

Joined: Apr 12, 2010
Posts: 25
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

Joined: Mar 16, 2010
Posts: 17
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

Joined: Apr 12, 2010
Posts: 25
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

Joined: May 18, 2012
Posts: 2
you can use variable in jasper ex: ( Report_count, page count,Column count )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in Jasper Report: increment on count
 
Similar Threads
Unable to export Jasper Report in html format.
PDF with jsf
jasper report- error
Jasper Report Design Problem
exported Jasper Report has different look than preview in IReport designer