jasper reports - Excel datasource in JasperReports/iReport: Unable to get value for field 'Date' of class 'java.sql.Date' -


i've used excel file datasource building report ireport. xls file contains dates yyyy-mm-dd format.

i've set date field class java.sql.date , click on preview in ireport. there error: unable to get value for field 'date' of class 'java.sql.date'.

i have tried java.util.date too. have ideas?

it quite simple.

i've xls file (birhdays.xls) this:

enter image description here

the datasource definition (in ireport) is:

enter image description here

as can see image above i've set yyyy-mm-dd format date field in ds definition.

the date field definition in jrxml file:

<field name="birthday" class="java.util.date"/> 

the full jrxml file:

<?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="excel_ds" language="groovy" pagewidth="595" pageheight="842" columnwidth="555" leftmargin="20" rightmargin="20" topmargin="20" bottommargin="20" uuid="b0f82d57-325b-4c30-b635-f464851e0a47">     <querystring>         <![cdata[]]>     </querystring>     <field name="name" class="java.lang.string"/>     <field name="birthday" class="java.util.date"/>     <columnheader>         <band height="20" splittype="stretch">             <statictext>                 <reportelement uuid="cd75f6d9-1781-4938-bf24-178b6663bcd1" x="0" y="0" width="147" height="20"/>                 <box leftpadding="10">                     <toppen linewidth="1.0"/>                     <leftpen linewidth="1.0"/>                     <bottompen linewidth="1.0"/>                     <rightpen linewidth="1.0"/>                 </box>                 <textelement textalignment="center" verticalalignment="middle">                     <font isbold="true" isitalic="true"/>                 </textelement>                 <text><![cdata[name]]></text>             </statictext>             <statictext>                 <reportelement uuid="5d4c21f1-9afd-40c7-ade0-6fcc0b3d8373" x="147" y="0" width="100" height="20"/>                 <box leftpadding="10">                     <toppen linewidth="1.0"/>                     <leftpen linewidth="1.0"/>                     <bottompen linewidth="1.0"/>                     <rightpen linewidth="1.0"/>                 </box>                 <textelement textalignment="center" verticalalignment="middle">                     <font isbold="true" isitalic="true"/>                 </textelement>                 <text><![cdata[birthday]]></text>             </statictext>         </band>     </columnheader>     <detail>         <band height="20" splittype="stretch">             <textfield>                 <reportelement uuid="82f5a338-ef5d-4838-8cd0-c2544af3a73d" x="0" y="0" width="147" height="20"/>                 <box leftpadding="10">                     <toppen linewidth="1.0"/>                     <leftpen linewidth="1.0"/>                     <bottompen linewidth="1.0"/>                     <rightpen linewidth="1.0"/>                 </box>                 <textelement/>                 <textfieldexpression><![cdata[$f{name}]]></textfieldexpression>             </textfield>             <textfield pattern="dd/mm/yyyy">                 <reportelement uuid="e6eb6f83-b8f3-42fd-b116-02db2322b6a5" x="147" y="0" width="100" height="20"/>                 <box leftpadding="10">                     <toppen linewidth="1.0"/>                     <leftpen linewidth="1.0"/>                     <bottompen linewidth="1.0"/>                     <rightpen linewidth="1.0"/>                 </box>                 <textelement/>                 <textfieldexpression><![cdata[$f{birthday}]]></textfieldexpression>             </textfield>         </band>     </detail> </jasperreport> 

and result (via preview in ireport):

enter image description here

note:

i've used ireport 5.1.0


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -