Answered
Assigning a Variable a Null Value
Hi all. I've got a loop that queries a query outside of the
loop. The problem is, the query may get defined, and it may not.
But if it gets defined, how do I undefine it for the next loop
iteration. Here's some code to wrap your head around it (edited for
brevity).
<cfloop>
<cfset queryValue = possibleEmptyString >
<cfif Len(queryValue)>
<cfquery name="queryName" dbtype="query">
select * from something
</cfquery>
</cfif>
<cfif IsDefined("queryName") AND queryName.RecordCount>
error="some error message"
</cfif>
</cfloop>
So, is there not a Function that sets the var to Undefined, or Null, or something? If not, what's the alternative?
Thanks all! 😉
<cfloop>
<cfset queryValue = possibleEmptyString >
<cfif Len(queryValue)>
<cfquery name="queryName" dbtype="query">
select * from something
</cfquery>
</cfif>
<cfif IsDefined("queryName") AND queryName.RecordCount>
error="some error message"
</cfif>
</cfloop>
So, is there not a Function that sets the var to Undefined, or Null, or something? If not, what's the alternative?
Thanks all! 😉