Woo hoo! It's ABOUT TIME!
Dave
*From:* [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] *On Behalf Of *Mike Kelp
*Sent:* Tuesday, June 26, 2007 10:54 AM
*To:* Dallas/Fort Worth ColdFusion User Group Mailing List
*Subject:* Re: [DFW CFUG] Problem with nested loop
I can say that it is fixed in CF 8 and I agree that it should be.
Reference from our favorite CF 8 Ad Creator:
http://www.bennadel.com/index.cfm?dax=blog:763.view
Mike.
Dave Crandell wrote:
Thanks for the info, Dave!
Glad it wasn't just me.... :)
On 6/26/07, [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> *<[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Yes, this is a bug, in 4.5, 5, MX and MX 7. You'd think they'd fix it
by now. Hopefully it's fixed in CF 8 (maybe someone who has the beta
up and running can test it out.)
And by the way, it doesn't matter whether your loops are cfoutputs or
cfloops, if they are nested, the nested loop cannot get the proper
values of the outer loop and you always have to set the variables like
this.
Dave
*From:* [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>[mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>] *On Behalf Of *Dave Crandell
*Sent:* Tuesday, June 26, 2007 9:37 AM
*To:* Dallas/Fort Worth ColdFusion User Group Mailing List
*Subject:* Re: [DFW CFUG] Problem with nested loop
Haha!
Nice!
I just did this...and it works great! Thanks Christopher!
<cfloop query="qWpLocs">
<cfset myLoc=qWpLocs.numLocationID />
<cfoutput><div
style="color:blue;">#myLoc#</div></cfoutput>
<!--- INSERT WizPlayer Production Content INTO
tblProductionContent --->
<cfoutput query="qProdContent">
<cfquery name="qInsWPProdContent"
datasource="#dbCn#" username="#dbUsr#" password="#dbPw#">
INSERT INTO tblProductionContent
(
numProductionID,
numLocationID,
txtBGMusicFile,
intSortOrder,
txtWaveFile,
txtUploadTime,
dtmUpload,
intContentID,
intChange,
intMusicInterval
)
VALUES
(
#qProdData.autProductionID#,
#myLoc#,
'#qProdData.txtBGMusicFile#',
#qProdContent.intSortOrder#,
'#qProdContent.txtWaveFile#',
'#qProdData.dtmUploaded#',
'#qProdData.txtUploadTime#',
#qProdContent.autProductionContentID#,
1,
#qProdData.intSeconds#
)
</cfquery>
<div>#myLoc#</div>
</cfoutput>
</cfloop>
On 6/26/07, *Christopher Jordan* < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Dave,
I seem to remember there being a problem (read: bug) accessing the
query values from a nested loop. That is, if you're outer most loop is
over a query, the inner loops won't have access to the query
variables. I cannot remember off-hand if this affects only <cfoutput>
looping or if it also affects <cfloop> looping. What you could do *I
think* is store the value of qWpLocs.numLocationID in a variable in
the outside loop, and then access that variable in the inner loop.
Chris
Dave Crandell wrote:
Hey guys - this code has been driving me nuts for two days now....
I've got a query that is supposed to insert data from a few different
recordsets ... all the data is inserted fine except the value
#qWpLocs.numLocationID#.
I print the variable twice for debugging and on the first iteration
just inside my loop of qWpLocs, it prints correctly. However when I
try to insert it/print it from inside my qProdContent output, it only
inserts and prints the value from the first iteration...
below is a sample of my debug output and below that is my code ... if
y'all can see what I may be doing wrong, that'd rule...
1834
1834
1834
1812
1834
1834
1820
1834
1834
1824
1834
1834
1826
1834
1834
1850
1834
1834
1866
1834
1834
1874
1834
1834
-------
<cfoutput>
<!--- INSERT WizPlayer Production Record INTO
tblProductions --->
<cfquery name="qInsWPProd" datasource="#dbCn#"
username="#dbUsr#" password="#dbPw#">
INSERT INTO tblProductions
(autProductionID, dtmCreated, numCustomerID, intDeleted)
VALUES (#qProdData.autProductionID#,
#Now()#, #qProdData.intCustomerID#, 0)
</cfquery>
</cfoutput>
<!--- LOOP THROUGH WP LOCATIONS--->
<cfloop query="qWpLocs">
<cfoutput><div
style="color:blue;">#qWpLocs.numLocationID#</div></cfoutput>
<!--- INSERT WizPlayer Production Content INTO
tblProductionContent --->
<cfoutput query="qProdContent">
<cfquery name="qInsWPProdContent"
datasource="#dbCn#" username="#dbUsr#" password="#dbPw#">
INSERT INTO tblProductionContent
(
numProductionID,
numLocationID,
txtBGMusicFile,
intSortOrder,
txtWaveFile,
txtUploadTime,
dtmUpload,
intContentID,
intChange,
intMusicInterval
)
VALUES
(
#qProdData.autProductionID#,
#qWpLocs.numLocationID#,
'#qProdData.txtBGMusicFile#',
#qProdContent.intSortOrder#,
'#qProdContent.txtWaveFile#',
'#qProdData.dtmUploaded#',
'#qProdData.txtUploadTime#',
#qProdContent.autProductionContentID#,
1,
#qProdData.intSeconds#
)
</cfquery>
<div>#qWpLocs.numLocationID#</div>
</cfoutput>
</cfloop>
--
Dave C
www.davesbizarre.com <http://www.davesbizarre.com>
------------------------------------------------------------------------
_______________________________________________
Reply to DFWCFUG:
[email protected] <mailto:[email protected]>
Subscribe/Unsubscribe:
<http://lists1.safesecureweb.com/mailman/listinfo/list>
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
<http://www.mail-archive.com/list%40list.dfwcfug.org/>
http://www.mail-archive.com/list%40list.dfwcfug.org/
<http://www.mail-archive.com/list%40dfwcfug.org/>
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.instantspot.com/ <http://www.instantspot.com/>
www.teksystems.com/ <http://www.teksystems.com/>
--
http://www.cjordan.us
_______________________________________________
Reply to DFWCFUG:
[email protected] <mailto:[email protected]>
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.instantspot.com/ <http://www.instantspot.com/>
www.teksystems.com/ <http://www.teksystems.com/>
--
Dave C
www.davesbizarre.com <http://www.davesbizarre.com>
_______________________________________________
Reply to DFWCFUG:
[email protected] <mailto:[email protected]>
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.instantspot.com/ <http://www.instantspot.com/>
www.teksystems.com/ <http://www.teksystems.com/>
--
Dave C
www.davesbizarre.com <http://www.davesbizarre.com>
------------------------------------------------------------------------
_______________________________________________
Reply to DFWCFUG:
[email protected] <mailto:[email protected]>
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.instantspot.com/ <http://www.instantspot.com/>
www.teksystems.com/ <http://www.teksystems.com/>
------------------------------------------------------------------------
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.instantspot.com/
www.teksystems.com/