Re: Query result set; making it available to custom tags when query is run from CF template?
>I'm trying to improve a page I've written. It's a calendar, and I'm >using a custom tag to display the calendar itself. On one view of the >calendar, there can be four calls to that calendar custom tag (one for >the current month, 3 for the next 3 months). Rather than call the >same stored procedure once per custom tag call, I'd rather call it >once total from the CFM template, and then make that result set >available to the custom tags. > >Is there a way to accomplish this, or do I just need to make multiple >calls to get the recordset? > >Thanks, > >Pete You could try putting the query into the request scope as in . The request scope is available to custom tags and child tags, as well as to all other pages associated with the calling page. From LiveDocs: -- Used to hold data that must be available for the duration of one HTTP request. The Request scope is available to all pages, including custom tags and nested custom tags, that are processed in response to the request. This scope is useful for nested (child/parent) tags. This scope can often be used in place of the Application scope, to avoid the need for locking variables. Several chapters discuss using the Request scope. -- http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/variab35.htm hth, larry -- Larry C. Lyons Web Analyst BEI Resources American Type Culture Collection email: llyons(at)atcc(dot)org tel: 703.365.2700.2678 -- ~| 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:225415 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: Query result set; making it available to custom tags when query is run from CF template?
Following on from that. Do a check in the custom tag to see if the query data already exists, if it does, use it, if it doesn't, get it. Or, if you're passing the query data into the tag then you will have done one query anyway. Ade -Original Message- From: Alan Rother [mailto:[EMAIL PROTECTED] Sent: 25 October 2005 03:39 To: CF-Talk Subject: Re: Query result set; making it available to custom tags when query is run from CF template? Well, if the one query contains all of the data needed by all of the custom tag calls in the same page request, you could just set the query into the request scope and it would be available to all of the custom tag calls. To do that simply follow this example: Doing this, any cfm file in the same request can access this query object HTH On 10/24/05, Pete Ruckelshaus <[EMAIL PROTECTED]> wrote: > > I'm trying to improve a page I've written. It's a calendar, and I'm > using a custom tag to display the calendar itself. On one view of the > calendar, there can be four calls to that calendar custom tag (one for > the current month, 3 for the next 3 months). Rather than call the > same stored procedure once per custom tag call, I'd rather call it > once total from the CFM template, and then make that result set > available to the custom tags. > > Is there a way to accomplish this, or do I just need to make multiple > calls to get the recordset? > > Thanks, > > Pete ~| 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:225308 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: Query result set; making it available to custom tags when query is run from CF template?
Well, if the one query contains all of the data needed by all of the custom tag calls in the same page request, you could just set the query into the request scope and it would be available to all of the custom tag calls. To do that simply follow this example: Doing this, any cfm file in the same request can access this query object HTH On 10/24/05, Pete Ruckelshaus <[EMAIL PROTECTED]> wrote: > > I'm trying to improve a page I've written. It's a calendar, and I'm > using a custom tag to display the calendar itself. On one view of the > calendar, there can be four calls to that calendar custom tag (one for > the current month, 3 for the next 3 months). Rather than call the > same stored procedure once per custom tag call, I'd rather call it > once total from the CFM template, and then make that result set > available to the custom tags. > > Is there a way to accomplish this, or do I just need to make multiple > calls to get the recordset? > > Thanks, > > Pete > > ~| 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:222153 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