No, the error occurs when there is no record returned.  Here is an example
of one of the queries:


<cfquery name="qPaymentsRecievedSum" datasource="affiliate">
SELECT SUM(apayments.Amount) AS PSum FROM apayments, trip, aregistration
WHERE (((trip.ID = apayments.TripID) AND (aregistration.TripID =
apayments.TripID)) AND ((apayments.AffiliateID = #Session.MM_UserID#) AND
((apayments.PostStatus = 2) AND ((apayments.Type = 2) AND (aregistration.ID
= #URL.recordID#)))))</cfquery>


I take the output from this query and several others and add or subtract
based on what I am trying to get.  If no records are returned, I get an
error because qPaymentsRecievedSum.PSum has no value and CF tells me that it
can't convert "" to a number to perform the calculation.

I thought that <cfparam name="qPaymentsRecievedSum.PSum" default="0"> this
would do it but it apparently doesn't.

Thanks for the help. 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Jamie Babineaux
Sent: Monday, June 13, 2005 2:20 PM
To: [email protected]
Subject: RE: Query

Would this be a case where in your query you add
something like "where 1=1" so that you always get a
recordset returned? 



--- "Knipp, Eric" <[EMAIL PROTECTED]> wrote:

> I guess this means this is the behavior when there

> are no records in the
> table?  Couldn't you just check the RecordCount
> property, and go from there?
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> Tim Starling
> Sent: Monday, June 13, 2005 2:14 PM
> To: [email protected]
> Subject: Query
> 
> 
> 
> How would I best do the following:  When I run a
> query to get a sum, if
> there is no value returned, set the value to 0. 
> I've tried <cfparam> and it
> doesn't seem to work - I guess it considers null a
> value.
> 
>  
> 
> Thanks,
> Tim
> 
>  
> 
>  
> 
>  
> 
> 
> 
> 
> -----------------------------------------
> CONFIDENTIALITY NOTICE: The information contained in
> this e-mail and
> attached document(s) may contain confidential
> information that is intended
> only for the addressee(s). If you are not the
> intended recipient, you are
> hereby advised that any disclosure, copying,
> distribution or the taking of
> any action in reliance upon the information is
> prohibited.  If you have
> received this e-mail in error, please immediately
> notify the sender and
> delete it from your system.
> 


"polymath \POLL-ee-math\, noun:
A person of great or varied learning; one acquainted with various subjects
of study."

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm






----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to