RE: Loop through a structure of structures
Nice tidy Alex, thanks, I'll use this. :-) -Original Message- From: Alexander Sherwood [mailto:[EMAIL PROTECTED] Sent: 12 October 2005 20:05 To: CF-Talk Subject: Re: Loop through a structure of structures Try this: [CFLOOP collection=RSStructure item=itm] [cfset thisQuery =RSStructure[itm]] [cfoutput query =thisQuery] .. query output code here [/cfoutput] [/CFLOOP] Hope this helps. -- Alex Andy Mcshane wrote: Hi all, I think I have been looking at this for too long and cannot figure out how to loop through and output a structure of query results. I have a CFC that will return multiple recordsets. I figured that the only way that I could return multiple recordsets from a CFC was to return them within a structure. My query runs inside my CFC and returns 17 individual recordsets. I create a structure and add each of these recordsets to it so my structure now looks like this; RSStructure RS1 query - Rows 2 AGE ID NAME 1 221 Wibble 2 212 Wobble RS2 query - Rows 3 AGE ID NAME 1 223 Wibble 2 214 Wobble 3 305 Woo RS3 query - Rows 3 AGE ID NAME 1 346 Wibble 2 237 Wobble 3 338 Woo This continues until I have 17 recordsets within my structure. I then return this structure to my calling page. Now I must be having a really brain dead day because for the life of me I cannot remeber how to reference each of my recordsets within this structure so that I can output the data, it must be simple but then again so must I be at the moment! Can anybody help this flagging programmer? ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:220876 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Loop through a structure of structures
On 10/12/05, Andy Mcshane [EMAIL PROTECTED] wrote: Thanks, I just realised that before I posted again, God alone knows what I thought I was trying to do with it earlier! The 17 recordsets are all returned via one stored procedure call within the CFC so there really is only DB call, couldn't do it any other way as the data that is returned is keyed on a position on screen so I have to get all top row, middle row, etc data. Without knowing all the details of your problem its possible that what you are trying to accomplish can be done with the group attribute of cfquery and one result set. If you group your recordsets with in your query with a column that describes the recordset and order by that group column, you can the use the cfouput with a group, for example LOCATION AGE ID NAME TOP 22 1 Wibble TOP 21 2 Wobble MIDDLE 22 3 Wibble MIDDLE 21 4 Wobble MIDDLE 30 5 Woo BOTTOM 34 6 Wibble BOTTOM 23 7 Wobble BOTTOM 33 8 Woo cfoutput query=myQuery group=Location #Location#BR cfoutput #Age# #ID# #Name#BR /cfoutput /cfoutput ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:220953 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Loop through a structure of structures
Hi all, I think I have been looking at this for too long and cannot figure out how to loop through and output a structure of query results. I have a CFC that will return multiple recordsets. I figured that the only way that I could return multiple recordsets from a CFC was to return them within a structure. My query runs inside my CFC and returns 17 individual recordsets. I create a structure and add each of these recordsets to it so my structure now looks like this; RSStructure RS1 query - Rows 2 AGE ID NAME 1 221 Wibble 2 212 Wobble RS2 query - Rows 3 AGE ID NAME 1 223 Wibble 2 214 Wobble 3 305 Woo RS3 query - Rows 3 AGE ID NAME 1 346 Wibble 2 237 Wobble 3 338 Woo This continues until I have 17 recordsets within my structure. I then return this structure to my calling page. Now I must be having a really brain dead day because for the life of me I cannot remeber how to reference each of my recordsets within this structure so that I can output the data, it must be simple but then again so must I be at the moment! Can anybody help this flagging programmer? ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:220801 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Loop through a structure of structures
Reference each query through the structure perhaps? Does this work? cfoutput query=structurename.RS1 /cfoutput cfoutput query=structurename.RS2 /cfoutput But this begs the question, why are there 17 recordsets? Might a single query do the job? Matthew Small Web Developer American City Business Journals 704-973-1045 [EMAIL PROTECTED] -Original Message- From: Andy Mcshane [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 12, 2005 11:21 AM To: CF-Talk Subject: Loop through a structure of structures Hi all, I think I have been looking at this for too long and cannot figure out how to loop through and output a structure of query results. I have a CFC that will return multiple recordsets. I figured that the only way that I could return multiple recordsets from a CFC was to return them within a structure. My query runs inside my CFC and returns 17 individual recordsets. I create a structure and add each of these recordsets to it so my structure now looks like this; RSStructure RS1 query - Rows 2 AGE ID NAME 1 221 Wibble 2 212 Wobble RS2 query - Rows 3 AGE ID NAME 1 223 Wibble 2 214 Wobble 3 305 Woo RS3 query - Rows 3 AGE ID NAME 1 346 Wibble 2 237 Wobble 3 338 Woo This continues until I have 17 recordsets within my structure. I then return this structure to my calling page. Now I must be having a really brain dead day because for the life of me I cannot remeber how to reference each of my recordsets within this structure so that I can output the data, it must be simple but then again so must I be at the moment! Can anybody help this flagging programmer? ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:220804 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Loop through a structure of structures
I really am having a bad day, as soon as I clicked submit I solved my own problem! I feel like a total waste of bandwidth today! Nurse! Hi all, I think I have been looking at this for too long and cannot figure out how to loop through and output a structure of query results. I have a CFC that will return multiple recordsets. I figured that the only way that I could return multiple recordsets from a CFC was to return them within a structure. My query runs inside my CFC and returns 17 individual recordsets. I create a structure and add each of these recordsets to it so my structure now looks like this; RSStructure RS1 query - Rows 2 AGE ID NAME 1 221 Wibble 2 212 Wobble RS2 query - Rows 3 AGE ID NAME 1 223 Wibble 2 214 Wobble 3 305 Woo RS3 query - Rows 3 AGE ID NAME 1 346 Wibble 2 237 Wobble 3 338 Woo This continues until I have 17 recordsets within my structure. I then return this structure to my calling page. Now I must be having a really brain dead day because for the life of me I cannot remeber how to reference each of my recordsets within this structure so that I can output the data, it must be simple but then again so must I be at the moment! Can anybody help this flagging programmer? ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:220805 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Loop through a structure of structures
Thanks, I just realised that before I posted again, God alone knows what I thought I was trying to do with it earlier! The 17 recordsets are all returned via one stored procedure call within the CFC so there really is only DB call, couldn't do it any other way as the data that is returned is keyed on a position on screen so I have to get all top row, middle row, etc data. Reference each query through the structure perhaps? Does this work? cfoutput query=structurename.RS1 /cfoutput cfoutput query=structurename.RS2 /cfoutput But this begs the question, why are there 17 recordsets? Might a single query do the job? Matthew Small Web Developer American City Business Journals 704-973-1045 [EMAIL PROTECTED] ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:220806 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Loop through a structure of structures
Try this: [CFLOOP collection=RSStructure item=itm] [cfset thisQuery =RSStructure[itm]] [cfoutput query =thisQuery] .. query output code here [/cfoutput] [/CFLOOP] Hope this helps. -- Alex Andy Mcshane wrote: Hi all, I think I have been looking at this for too long and cannot figure out how to loop through and output a structure of query results. I have a CFC that will return multiple recordsets. I figured that the only way that I could return multiple recordsets from a CFC was to return them within a structure. My query runs inside my CFC and returns 17 individual recordsets. I create a structure and add each of these recordsets to it so my structure now looks like this; RSStructure RS1 query - Rows 2 AGE ID NAME 1 221 Wibble 2 212 Wobble RS2 query - Rows 3 AGE ID NAME 1 223 Wibble 2 214 Wobble 3 305 Woo RS3 query - Rows 3 AGE ID NAME 1 346 Wibble 2 237 Wobble 3 338 Woo This continues until I have 17 recordsets within my structure. I then return this structure to my calling page. Now I must be having a really brain dead day because for the life of me I cannot remeber how to reference each of my recordsets within this structure so that I can output the data, it must be simple but then again so must I be at the moment! Can anybody help this flagging programmer? ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:220849 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54