user2218550
user2218550

Reputation: 147

Serial Number Repeating in Jasper Reports

I have used $V{REPORT_COUNT} TO DISPLAY SERIAL NUMBER OF THE RECORDS.For Each Record that is fetched from the database the serial number is displayed correctly.

However if one record that is printed has data more then it can accommodate on a page, it is displayed on the next page. I am fine with that too, however the serial number is again shown for that page Eg. 3 is the serial number and if 3 could not be accommodated on the same page the record is written in the next page and the order of serial number is 1 2 3 (First Page) 3 4 5 etc(second Page).

I want 3 to be displayed only once in the first page and not in the second page. I have uploaded a image of my layout and I do not want to show the circled partenter image description here I am Using Ireport to design the page

Text Field Properties This is for the REPORT_COUNT TEXTFIELD

<reportElement
                        mode="Opaque"
                        x="0"
                        y="0"
                        width="15"
                        height="30"
                        backcolor="#D3D3D3"
                        key="textField-9"
                        stretchType="RelativeToBandHeight"
                        positionType="Float"
                        isPrintRepeatedValues="false"
                        isRemoveLineWhenBlank="true"
                        isPrintWhenDetailOverflows="true"/>
                    <box topBorder="Thin" topBorderColor="#000000" leftBorder="Thin" leftBorderColor="#000000" rightBorder="Thin" rightBorderColor="#000000" bottomBorder="Thin" bottomBorderColor="#000000"/>
                    <textElement textAlignment="Center" verticalAlignment="Top">
                        <font fontName="Times New Roman" pdfFontName="Times-Bold" size="10" isBold="true"/>
                    </textElement>
                <textFieldExpression   class="java.lang.Integer"><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
                </textField>

This properties for the right hand side text box which displays data:

<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        mode="Opaque"
                        x="12"
                        y="0"
                        width="523"
                        height="13"
                        forecolor="#000000"
                        backcolor="#D3D3D3"
                        key="textField-2"
                        positionType="Float"
                        isRemoveLineWhenBlank="true"/>
                    <box topBorder="Thin" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="Thin" rightBorderColor="#000000" bottomBorder="Thin" bottomBorderColor="#000000"/>
                    <textElement verticalAlignment="Middle">
                        <font fontName="SansSerif" pdfFontName="Times-Bold" size="8" isBold="true"/>
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA["   "+$F{vesselName}+($F{type} == null ? "" : " ("+$F{type}+")")]]></textFieldExpression>
                </textField>

Upvotes: 0

Views: 551

Answers (2)

Deepesh kumar Gupta
Deepesh kumar Gupta

Reputation: 896

Set a few properties to your variable:

<variable name="RECORD_COUNT" class="java.lang.String" incrementType="Column" calculation="Count">
    <initialValueExpression><![CDATA[1]]></initialValueExpression>
</variable>

Upvotes: 0

Viki888
Viki888

Reputation: 2774

Can you just tell us the properties you have set for the text fields?

I have just made a rough design of your scenario and I did not come across your issue. The row_count value is not getting repeated.

Refer below image. enter image description here

Upvotes: 0

Related Questions