RE: Multiple queries from a CFC? Drop in Array?
> > Why? It will almost certainly be a much better solution > > than anything else you're considering. > > Dave - Not sure it's better than 'anything else.' Why stick > with a query that'd need constant grouping when what he's got > in the DB is a set representing a hierarchical data structure? > > Instead of returning a query that'd need grouping each time > you use it, you could build up a struct once (by grouping) > and then logically navigate / manipulate it on an ad-hoc basis ... I didn't say "anything else", but rather "anything else [he] was considering". That said, you could certainly store the grouped query results however you like; you could even store the generated page output. None of that is inconsistent with my suggestion, which simply involved having one query instead of a series of queries. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309146 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Multiple queries from a CFC? Drop in Array?
> Why? It will almost certainly be a much better solution than > anything else > you're considering. Dave - Not sure it's better than 'anything else.' Why stick with a query that'd need constant grouping when what he's got in the DB is a set representing a hierarchical data structure? Instead of returning a query that'd need grouping each time you use it, you could build up a struct once (by grouping) and then logically navigate / manipulate it on an ad-hoc basis: #order.dateCreated# #order.giftCertificate.amount# #arrayLen(order.statusComments)# -Joe ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309140 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Multiple queries from a CFC? Drop in Array?
Oh, I don't have a good reason, just habit. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309092 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Multiple queries from a CFC? Drop in Array?
> I can do that and it was suggested. I just hate having > duplicate query data in every row. Why? It will almost certainly be a much better solution than anything else you're considering. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309091 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Multiple queries from a CFC? Drop in Array?
I can do that and it was suggested. I just hate having duplicate query data in every row. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309089 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Multiple queries from a CFC? Drop in Array?
> What would be the best way to write the view for this data? I > need to display the main order information first and then > loop over the order parts with another loop for each of the > order line items for each part. I don't want to be calling > the getOrderLineItems query during each order part loop > because that breaks the separation of presentation from the > backend. I haven't read the whole thread, but if you have a hierarchical data set (orders, lineitems), why not just return them in one query and use the GROUP attribute of CFOUTPUT to display them? Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309088 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Multiple queries from a CFC? Drop in Array?
What would be the best way to write the view for this data? I need to display the main order information first and then loop over the order parts with another loop for each of the order line items for each part. I don't want to be calling the getOrderLineItems query during each order part loop because that breaks the separation of presentation from the backend. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309087 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Multiple queries from a CFC? Drop in Array?
> So it's a trade off between efficiency and reusability in this case. Yes, though I'd imagine the efficiency difference in this case would be neglible. Your current stored proc is executing multiple queries; calling multiple stored procs each with single queries is not going to make a noticeable difference *I'd imagine*. Dominic -- Blog it up: http://fusion.dominicwatson.co.uk ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309081 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Multiple queries from a CFC? Drop in Array?
I guess I'll do that. So it's a trade off between efficiency and reusability in this case. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309080 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Multiple queries from a CFC? Drop in Array?
> In this case, I would probably just create a denormalized recordset > rather than multiple structures. Yes, I'd either go with this suggestion OR create a method for each of the queries (which would mean scrapping or splitting the storedprocs) .. Doing this increases reusability which I assume is one of your goals in moving to cfcs. HTH Dominic -- Blog it up: http://fusion.dominicwatson.co.uk ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309054 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Multiple queries from a CFC? Drop in Array?
In this case, I would probably just create a denormalized recordset rather than multiple structures. This recordset would have redundant information for the order and order parts such as: OrderID CustomerID OrderDate OrderPartID OrderPartInfo OrderLineItemID OrderLineItemDesc OrderLineItemPrice Then, use CFOUTPUT's GROUP attribute to remove the redundancy. m!ke -Original Message- From: Ian Rutherford [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2008 5:05 PM To: CF-Talk Subject: Re: Multiple queries from a CFC? Drop in Array? But since each order can have multiple parts which can have multiple line items, how would that go into a structure? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309045 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Multiple queries from a CFC? Drop in Array?
But since each order can have multiple parts which can have multiple line items, how would that go into a structure? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309039 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Multiple queries from a CFC? Drop in Array?
How would that work since each order can have multiple parts and each part can have multiple line items? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309034 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Multiple queries from a CFC? Drop in Array?
I'd return a struct. Put each query result into one key of the struct. On Mon, Jul 14, 2008 at 12:43 PM, Ian Rutherford <[EMAIL PROTECTED]> wrote: > I am trying to move some of my database access to cfcs and am trying to > figure out how to get a set of five query results in a stored procedure out > of a cffunction. I think I would use an array but am having a hard time > visualizing how it would work. > > The stored proc returns: > > An order. Each order can have n parts. Each part can have n line items. The > order can also have multiple gift certificates and status comments attached > to it. I could loop through the order parts calling another cffunction to get > each piece but that would result in a lot of database calls that I don't > think I need to make. Am I right about using an array? -- mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308992 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4