Yeah, pretty stupid, I know!
 
I can hit myself in the head, thought I knew the ins and outs of CF, but apearently I still have some surpises left for me...
I don't know why, but I was always under the impression that if I scoped the variables within loop over a query like;
queryName.column
I would only receive the first row as all output, but I have seen the light, this is not the case..
 
Again, unbelievably stupid, I will hide myself for a while now...
 
----- Original Message -----
Sent: Monday, February 03, 2003 12:31 PM
Subject: [cfaussie] RE: SCOPE!!

I don't understand why you are looping over query outputs like that anyway.
I always use a <cfoutput query="myQuery">
and then you just scope the values like any other scoped variable, eg myQuery.username
 
Darren Tracey
-----Original Message-----
From: Taco Fleur [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 03, 2003 12:25 PM
To: CFAussie Mailing List
Subject: [cfaussie] SCOPE!!

FYI:
Just something I only just discovered after many years of programming in CF...
 
I ALWAYS scope ANY variable, except for in query loops, because if I would scope them in query loops, I would have to scope them like
queryName.fieldName[int], and I assume that would bring along extra overhead.
Besides, I always knew that CF looks in all scopes if a variable is not scoped, but I never imagined that it would do so within a loop over a query!
 
Anways, today I had a client variable called "client.username" set, and I also used the variable name "username" within a loop over a query, one of the fieldnames was "username" however this field did not exist in the query but I did not get an error because the variable was present in the client scope!
 
<cfloop query"queryName">
#username#
</cfloop>
 
 
I can't think of anything that will resolve this issue but to rename the client variable or scope the variables within a query loop! Like;
 
<cfloop from="1" to="queryName.recordCount" index="i">
#queryName.username[i]#
</cfloop>
 
Anyone care to comment?
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/
---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to