Try explicitly scoping the variable

As in variables.PastDueInvoices - first its just good form, second it does
make the app run faster, as when you don't provide the explicit scope, CF
has to check through a number of scopes for it. It could also explain the
issue - if for example anywhere else in your app you are using that var
name in say, Application, Server, Request or Session scope.

On Wed, Aug 22, 2012 at 2:51 PM, Brian Cain <[email protected]> wrote:

>
> It is not in a CFC
>
>         <CFQUERY name="PastDueInvoices" datasource="#appdatasource#">
> SELECT r.ID,
> r.InvoiceDate,
> r.DueByDate,
> r.DatePaid,
> r.Approved,
> Sum(li.Quantity*li.Cost) - Sum(li.Quantity*li.Discount) as AmountDue
> FROM Receipts r
> LEFT JOIN LineItems li ON li.ReceiptID = r.ID
> WHERE r.SubscriberID = #session.stUser.ID#
> AND r.Approved = 1
> AND r.DatePaid is null
> AND IsNull(r.HideMyAccount, 0) <> 1
> GROUP By r.ID, r.InvoiceDate, r.DueByDate, r.DatePaid, r.Approved
> HAVING Sum(li.Quantity*li.Cost) - Sum(li.Quantity*li.Discount) > 0
> ORDER BY r.Approved DESC, r.InvoiceDate DESC
> </CFQUERY>
> <cfif IsDefined("PastDueInvoices")>
> <CFIF PastDueInvoices.RecordCount GT 0>  IT ERRORS RIGHT HERE!
>
>
> This is copied and pasted directly form the cfm page.  The condition to
> look and the record count attribute was literally the next line of code
> before I added the IsDefined check.
>
> On Wed, Aug 22, 2012 at 4:46 PM, Cameron Childress <[email protected]
> >wrote:
>
> >
> > On Wed, Aug 22, 2012 at 5:38 PM, Brian Cain <[email protected]> wrote:
> >
> > > Has anyone encountered this behavior, or have any idea why this is
> > > occurring?
> >
> >
> > Is it in a CFC? Smells like an improperly scoped query. Show some code?
> >
> > -Cameron
> >
> > --
> > Cameron Childress
> > --
> > p:   678.637.5072
> > im: cameroncf
> > facebook <http://www.facebook.com/cameroncf> |
> > twitter<http://twitter.com/cameronc> |
> > google+ <https://profiles.google.com/u/0/117829379451708140985>
> >
> >
> >
>
> 

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

Reply via email to