I have a query that I am calling to update an email service. Most times it will have data in it, but in testing I came across the situation of it not returning any data because there was no data to return. In the case of no data it returns the error "Variable EDITEDACCTS is undefined".
I have tried wrapping the query in a <cftry>
but it doesn't "fail" per se so it does not trip the <cfcatch>
. I have also tried defining the variable
var EditedAccts = QueryNew("")
as well as simply trying
<cfif NOT isDefined(#EditedAccts#)>
and it always returns "Variable EDITEDACCTS is undefined".
I need a production ready solution to this and I'm hoping somewhere here on SO can help me out.
Thanks in advance for your help.
EditedAccts
which triggers the very error you are trying to prevent. Is this a basic select query? Because the query object itself should still exist even if it does not contain any records. – Leigh<cfif NOT isDefined("EditedAccts")>
– LeighSELECT
query should always exist. Just wondering if you ran into a possible bug or are misunderstanding cfquery. – LeighSELECT
statement with a couple of nested queries but it was simply a misunderstanding on my part ofisDefined()
as a function. A perfect example of how awesome SO can be when you just aren't catching the obvious error in front of you. Thanks again for the help. – JimP