Hi there

I was hoping you could help me with a problem - I have a calculated value from the 
following code:

<cfoutput><cfset newTotal =(Recordset2.TOTAL - Recordset1.TOTAL)>#newTotal# </cfoutput>

Which works just fine when the Recordset2.TOTAL and Recordset1.TOTAL are populated by 
the SQL (as set by search parameters on a previous page).  

However, on occasion Recordset2.Total is equal to nothing (null?) while 
Recordset1.TOTAL has a value due to the search string, and when this happens, CF 
throws an error which reads:

"An error occurred while evaluating the expression: 

  newTotal =(Recordset2.TOTAL - Recordset1.TOTAL)

 Error near line 316, column 17.

 Cannot convert to number."

Is there anyway to get around this such as an If Recordset.TOTAL = nothing, Then 
[don't subtract]? 

My apologies that I am only just starting to learn how to write coded stuff.

Many thanks,

Gryphawk


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to