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

Issue in printing the values using jasper reports


ravinderannaram50

Recommended Posts

I am new to Ireport designs

I need to print the values of invoice id, duedateand   amountfrom table invoice table. I have used the textfieldexpressions but it is printing as null .

I have checked my query manually it is executing fine.But,the probelm is getting when I use in design

The parameters are correct and the paramaeter which i use in this design are working for other designs.

Please help me how to print the values.

 

My code:

 

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="balkatel-esr-sub_srpski" pageWidth="595" pageHeight="70" whenNoDataType="AllSectionsNoDetail" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" >
    <property name="com.jasperassistant.designer.GridHeight" value="12"/>
    <property name="com.jasperassistant.designer.GridWidth" value="12"/>
    <property name="com.jasperassistant.designer.SnapToGrid" value="false"/>
    <property name="com.jasperassistant.designer.Grid" value="false"/>
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <parameter name="customerId" class="java.lang.String"/>
    <parameter name="invoiceId" class="java.lang.Integer"/>
    <parameter name="invoiceDueDate" class="java.lang.String"/>
    <queryString>
        <![CDATA[select count(*) from invoice where id=$P{invoiceId};]]>
    </queryString>
    
    <field name="amount" class="java.math.BigDecimal"/>
    <variable name="total" class="java.math.BigDecimal" calculation="Sum">
        <variableExpression><![CDATA[$F{amount}]]></variableExpression>
    </variable>
    <columnHeader>
        <band height="34">
            <staticText>
                <reportElement x="12" y="10" width="100" height="16" />
                <textElement>
                    <font size="11" isBold="false"/>
                </textElement>
                <text><![CDATA[Racun Od]]></text>
            </staticText>
            <staticText>
                <reportElement x="180" y="10" width="70" height="14" />
                <textElement>
                    <font size="10" isBold="false"/>
                </textElement>
                <text><![CDATA[broj Racuna]]></text>
            </staticText>
            <staticText>
                <reportElement x="394" y="12" width="69" height="14" />
                <textElement textAlignment="Left" verticalAlignment="Middle">
                    <font size="10" isBold="false"/>
                </textElement>
                <text><![CDATA[iznos ]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="17">
            <textField>
                <reportElement x="14" y="0" width="150" height="16" />
                <textElement verticalAlignment="Middle">
                    <font size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{invoiceId}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="180" y="0" width="83" height="14" />
                <textElement verticalAlignment="Middle">
                    <font size="10"/>
                </textElement>
                <textFieldExpression><![CDATA[$P{invoiceDueDate}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <summary>
        <band height="20">
            <textField>
                <reportElement x="394" y="1" width="129" height="15" forecolor="#000000" />
                <textElement textAlignment="Right" verticalAlignment="Bottom">
                    <font size="10" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{total})]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="250" y="1" width="100" height="15" />
                <text><![CDATA[ukupno CHF . . . . . . . . . . . . . . . . .]]></text>
            </staticText>
        </band>
    </summary>
</jasperReport>
 

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

1.
"I need to print the values of invoice id, duedateand   amountfrom table invoice table. I have used the textfieldexpressions but it is printing as null ."

I do not see any fields in detail band

2.
You define fields:
<field name="description" class="java.lang.String"/>
    <field name="price_per_item" class="java.math.BigDecimal"/>
    <field name="quantity" class="java.lang.Integer"/>

which not used in query

Your report is chaotic. For example
<textFieldExpression><![CDATA[$P{amount}]]></textFieldExpression>   and report not content parameter $P{amount}
... and so on....

RTFM


 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...