CFLoop error

I'm trying to calculate a sum in the following ColdFusion document.  When I do this sum with a dollar value, it works, and when I leave out the sum (just do line-by-line detail), it works.  When I try to run the following document, I get this error:  'The value "" cannot be converted to a number'


<cfquery name="campaign07" datasource="Pluto" dbtype="ODBC">
SELECT     ORGNAME1 AS Name, LDR_ORG_2006_UWSVANNUALCA_NBROFLEADERS_ALLLEADERS AS LdrN06
FROM         dbo.DATAEXTRACTANDARCAMPAIGN2006S
</cfquery>

<cfheader name="Content-Disposition" value="inline;filename=CampaignUpdate.xls">
<cfcontent type="application/msexcel">

<Table border="1" cellspacing="1">

<thead>
<tr>
<td>Name</td>
<td>LdrN06</td>
</tr>
</thead>

<cfset MyLdrN06 = 0>

<tbody>
<cfoutput query="campaign07">
<tr>
<td>#Name#</td>
<td>#NumberFormat(LdrN06,"99,999,999")#</td>
</tr>

<cfset MyLdrN06 = MyLdrN06 + LdrN06>
      
</cfoutput>
</tbody>

<tfoot>
<cfoutput>
<tr>
<td>TOTALS</td>
    <td>#NumberFormat(MyLdrN06,"99,999,999")#</td>
</tr>
</cfoutput>
</tfoot>

</table>
ssdanishAsked:
Who is Participating?
 
_agx_Commented:
Glad to assist :)  So did this answer your question?
0
 
_agx_Commented:
> 'The value "" cannot be converted to a number'

That means you're trying to use a string "" where a number is expected.  I don't know which line is throwing the error, but try using the Val() function.  It will convert non-numeric values like ""  to 0.  

<cfset MyLdrN06 = MyLdrN06 + val(LdrN06)>
0
 
ssdanishAuthor Commented:
great; that worked; thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.