Jump to content
We've recently updated our Privacy Statement, available here ×

mario.rossi

Members
  • Posts

    7
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Posts posted by mario.rossi

  1. Here it is: it's a master report including a subreport; I reduced my problem to a very simple case where the subreport only prints 'CIAO' for many times, and on the left bottom side of the master page I count  the page number: I post first the master jrxml, then the detail;

    thank you!

    G

     


    ------------------------------------ MASTER REPORT ------------------------------------------------------

    <?xml version="1.0" encoding="UTF-8"  ?>
    <!-- Created with iReport - A designer for JasperReports -->
    <!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
    <jasperReport
             name="nuovo3" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535"
         columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false">
        <property name="ireport.scriptlethandling" value="0" />
        <property name="ireport.encoding" value="UTF-8" />
        <import value="java.util.*" />
        <import value="net.sf.jasperreports.engine.*" />
        <import value="net.sf.jasperreports.engine.data.*" />

        <queryString><![CDATA[sELECT rownum,'ciao' as ciao
    FROM DT_KPI
    where rownum<50]]></queryString>

        <field name="ROWNUM" class="java.math.BigDecimal"/>
        <field name="CIAO" class="java.lang.String"/>

            <background>
                <band height="0"  isSplitAllowed="true" >
                </band>
            </background>
            <title>
                <band height="100"  isSplitAllowed="true" >
                    <staticText>
                        <reportElement
                            x="55"
                            y="43"
                            width="412"
                            height="40"
                            forecolor="#000000"
                            backcolor="#FFFFFF"
                            key="staticText"/>
                        <box>                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <bottomPen lineWidth="0.0" lineColor="#000000"/>
                        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
    </box>
                        <textElement textAlignment="Center">
                            <font size="30"/>
                        </textElement>
                    <text><![CDATA[Key Performances Indicator - Bandwidth]]></text>
                    </staticText>
                    <line direction="TopDown">
                        <reportElement
                            x="0"
                            y="3"
                            width="534"
                            height="0"
                            key="line"/>
                        <graphicElement stretchType="NoStretch"/>
                    </line>
                </band>
            </title>
            <pageHeader>
                <band height="0"  isSplitAllowed="true" >
                </band>
            </pageHeader>
            <columnHeader>
                <band height="2"  isSplitAllowed="true" >
                </band>
            </columnHeader>
            <detail>
                <band height="121"  isSplitAllowed="true" >
                    <subreport  isUsingCache="true">
                        <reportElement
                            x="0"
                            y="38"
                            width="534"
                            height="67"
                            key="subreport-2"
                            isRemoveLineWhenBlank="true"/>
                        <subreportParameter  name="par">
                            <subreportParameterExpression><![CDATA[$F{CIAO}]]></subreportParameterExpression>
                        </subreportParameter>
                        <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                        <subreportExpression  class="java.lang.String"><![CDATA["nuovo_sottoreport2.jasper"]]></subreportExpression>
                    </subreport>
                </band>
            </detail>
            <columnFooter>
                <band height="0"  isSplitAllowed="true" >
                </band>
            </columnFooter>
            <pageFooter>
                <band height="29"  isSplitAllowed="true" >
                    <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                        <reportElement
                            x="285"
                            y="6"
                            width="170"
                            height="19"
                            forecolor="#000000"
                            backcolor="#FFFFFF"
                            key="textField"/>
                        <box>                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <bottomPen lineWidth="0.0" lineColor="#000000"/>
                        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
    </box>
                        <textElement textAlignment="Right">
                            <font size="10"/>
                        </textElement>
                    <textFieldExpression   class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression>
                    </textField>
                    <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None"  hyperlinkTarget="Self" >
                        <reportElement
                            mode="Transparent"
                            x="461"
                            y="6"
                            width="36"
                            height="19"
                            forecolor="#000000"
                            backcolor="#FFFFFF"
                            key="textField"/>
                        <box>                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <bottomPen lineWidth="0.0" lineColor="#000000"/>
                        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
    </box>
                        <textElement>
                            <font size="10"/>
                        </textElement>
                    <textFieldExpression   class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression>
                    </textField>
                    <line direction="TopDown">
                        <reportElement
                            x="0"
                            y="3"
                            width="535"
                            height="0"
                            key="line"/>
                        <graphicElement stretchType="NoStretch"/>
                    </line>
                    <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                        <reportElement
                            x="1"
                            y="6"
                            width="209"
                            height="19"
                            forecolor="#000000"
                            backcolor="#FFFFFF"
                            key="textField"/>
                        <box>                    <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
                        <bottomPen lineWidth="0.0" lineColor="#000000"/>
                        <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
    </box>
                        <textElement>
                            <font size="10"/>
                        </textElement>
                    <textFieldExpression   class="java.util.Date"><![CDATA[new Date()]]></textFieldExpression>
                    </textField>
                </band>
            </pageFooter>
            <summary>
                <band height="0"  isSplitAllowed="true" >
                </band>
            </summary>
    </jasperReport>


    ---------------------------------------------------- DETAIL REPORT ---------------------------

    <?xml version="1.0" encoding="UTF-8"  ?>
    <!-- Created with iReport - A designer for JasperReports -->
    <!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
    <jasperReport
             name="nuovo_sottoreport2" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0"
         leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false">
        <property name="ireport.scriptlethandling" value="0" />
        <property name="ireport.encoding" value="UTF-8" />
        <import value="java.util.*" />
        <import value="net.sf.jasperreports.engine.*" />
        <import value="net.sf.jasperreports.engine.data.*" />

        <parameter name="par" isForPrompting="true" class="java.lang.String"/>
        <queryString><![CDATA[sELECT 'ciaoSottoReport' as ciao, rownum
    FROM DT_KPI where rownum<5]]></queryString>

        <field name="CIAO" class="java.lang.String"/>
        <field name="ROWNUM" class="java.math.BigDecimal"/>

            <background>
                <band height="0"  isSplitAllowed="true" >
                </band>
            </background>
            <title>
                <band height="0"  isSplitAllowed="true" >
                </band>
            </title>
            <pageHeader>
                <band height="0"  isSplitAllowed="true" >
                </band>
            </pageHeader>
            <columnHeader>
                <band height="0"  isSplitAllowed="true" >
                </band>
            </columnHeader>
            <detail>
                <band height="19"  isSplitAllowed="true" >
                    <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                        <reportElement
                            x="0"
                            y="0"
                            width="100"
                            height="18"
                            key="textField"/>
                        <box></box>
                        <textElement>
                            <font/>
                        </textElement>
                    <textFieldExpression   class="java.lang.String"><![CDATA[$F{CIAO}]]></textFieldExpression>
                    </textField>
                </band>
            </detail>
            <columnFooter>
                <band height="0"  isSplitAllowed="true" >
                </band>
            </columnFooter>
            <pageFooter>
                <band height="0"  isSplitAllowed="true" >
                </band>
            </pageFooter>
            <summary>
                <band height="0"  isSplitAllowed="true" >
                </band>
            </summary>
    </jasperReport>
     

  2. Hi everybody,

    I am using JasperReport 3.1.3 libraries;

    In the report I want to have in each page a page number information like 1/20, 2/20 ...

    I made it with two  PAGE_NUMBER variables, one with calculation time set to "now" and one with calculation time set to "report";

    The problem is that when my report has more than 20 pages the calculation of the total page number fails, and it does not print it unless in some page;

    it seems like all variables with calculation set to "report" do not work properly...

    Have you ever had this problem??

    Thank you in advance

    Greetings

    Giulio

×
×
  • Create New...