That's one approach. There are probably several, but that won't solve your
problem if your queries return zero records. If that's the case, then you
might need something like this:
<cfif query.recordCount>
<cfset varA = variable * variable >
<cfelse>
<cfset varA = 0>
</cfif>
This if statement will do your calculation only if the query returned records.
Since you are using more than one query, you could modify it for both:
<cfif query1.recordCount AND query2.recordCount>
Just a side note: when evaluating a numeric value in a CFIF statement, you do
not need to compare it to a value when all you care is if it is 0 or greater
than 0... this:
<cfif query1.recordCount GT 0>
Can be this:
<cfif query1.recordCount>
It's basically evaluating it as a true or false where zero = false and anything
other than zero is true (not sure if negative numbers would evaluate to true,
but in this case, you won't have a negative number as a recordCount).
Dave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:5805
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm