Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFLoop prevents cfif evaluation??

Status
Not open for further replies.

ApexSys

Programmer
Jan 10, 2001
15
US
I have a large block of code within a <cfquery>
At the end of this block of code I have a <cfif status is 1> that evaluates fine.....

BUT if I wrap this entire block of code (including the CFQuery) in a <CFLoop query=someQuery>
The cfif fail to evaluate &quot;1&quot; no matter how I present that cfif.
Why? All my <cfif>'s inside the <cfquery> block still evaluate fine.
??
Here's a brief example of the code.

<cfquery name=&quot;dNames&quot;>
<!--- CFLOOP starts --->
<cfloop query=&quot;dNames&quot;>
<cfset SID = #dNames.NameID#>

<cfquery name=&quot;dReport&quot; datasource=&quot;dsn&quot;>
SELECT * FROM Report ......
</cfquery>

<cfif x=something><cfset Down = something></cfif>

<!--- Query Loop Starts Here --->
<cfoutput query=&quot;dReport&quot;>
<cfif cDate eq 0>
<cfset cDate = something>
<cfelse>
<cfset cDateTime = #StatusTimeEdit#>
</cfif>
</cfoutput>
<!--- Query Loop Ends Here --->

***THIS IS THE ONLY <CFIF> THAT FAILS !!!!!!! ****
<cfif cStatus is 1>
<cfset UP = something>
</cfif>

</cfloop>

This code example isn't meant to be followed....it's only to represent the positioning of the code blocks. Basically why does the final CFIF evaluate fine with the inner CFQuery alone and then fail when I wrap all the code witha &quot;CFLoop query =&quot; ???

Thanks,
-=-=-=-=-=-=-=-=-=-=-=-=-=-
Apex Systems Consulting
e-Solutions for Small Business
 
First, I assume you're not really using <cfquery> like a <cfoutput> block before the main <cfloop>. Second, what variable scope is cStatus in? (form,url,cgi,query,local,etc..)

I would try outputting the value of cStatus right before the <cfif> so you can see what it's value is. I suspect you will find it's not what you're expecting. Then try outputting it before the <cfquery>, then before the <cfloop>, etc.. so you can track back where the value gets changed.

GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top