denuno / cfjasperreport

Run JasperReports from your CFML application
15 stars 7 forks source link

Exception "can't cast empty string to a number value" #2

Closed gjbecerril closed 10 years ago

gjbecerril commented 10 years ago

I encountered this exception when running this lines of code:

<cfquery name="myQuery" datasource="#datasource#">
    select * from myTable
</cfquery>

<jr:jasperreport jrxml="#datapath#/sample-001.jrxml" query="#myQuery#" xportfile="#workpath#/sample-001.pdf" exporttype="pdf"/>

I fixed it by modifying the jasperreport.cfc file and replacing line 418 with the following:

<cfif len(trim(q[col][currentRow]))>
    <cfset stTmp["#col#"] = javaCast("int",q[col][currentRow]) />
<cfelse>
    <cfset stTmp["#col#"] = javaCast("null","") />
</cfif>

I wish I could have sent out a pull request for this fix, but I guess that CFC is not shared?

image

Thanks, -Javier

denuno commented 10 years ago

Thanks for the pull req!