Adam,

Most likely, yes.  Do some debugging to find out.  Add some code like this:

<cfdump var="#avgStoreData#">
<cfdump var="#getParts#">
Leadtime:  <cfoutput>#getParts.leadTime#</cfoutput><br>
AvgNum: <cfoutput>#avgStoreData.avgNum#</cfoutput><br>
<cfabort>

This will help you figure out which one is 'empty' or 'null'.  If one of your 
queries is returning zero records, then you will have a null or 'empty string' 
value.  CF really doesn't have Null values, they are always converted to empty 
strings (even if the database is returning null).

Once you do the above, that should help you figure out what's not right.

Dave

-----Original Message-----
From: Adam Parker [mailto:[email protected]] 
Sent: Monday, February 27, 2012 7:55 AM
To: cf-newbie
Subject: Multiplying Variables


Hello - 

I am attempting to multiply variables to produce a calculation.

The calculation is:  <cfset varA = paddedLeadTime*avgStoreData.avgNum>

PaddedLeadTime comes from a variable created from a query:
<cfset paddedLeadTime = #getParts.leadTime# + 21>
LeadTime may contain null values so I have used isNull in the query: 
ISNULL(n.leadTime,0) as 'leadTime'

avgStoreData.avgNum comes from a QoQ:
        select count(distinct(ordernum)) as AvgNum
        from getAvgStoreData
        where partnum = '#getparts.partnum#'

When multiplying the variables, <cfset varA = 
paddedLeadTime*avgStoreData.avgNum>,
an error occurs stating:  The value '' cannot be converted to a number.  Is 
this because one of the values is null?  How can I alleviate this error?



Thank you. 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5803
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm

Reply via email to