I almost never use arrays when dealing with data that already exists in a query unless I have to build pivot tables and the back-end database does not support them.
Also, if I'm using dynamic form fields where the form passes multiple comma delimited lists, I'll put them in arrays as I find that easier for looping over an array than parsing the the form element. Arrays aren't necessary for either, but convenient. Cfquery is the heart of Coldfusion, very powerful and your best friend when it comes to integrating your data with your web pages. Learn queries thoroughly, and only if you find something you cannot do with a query would you need to look at arrays. On Thu, Sep 2, 2010 at 3:41 PM, Lewis Billingsley <[email protected]> wrote: > > Thanks Maureen. > > My CF knowledge is pretty basic. I'd be curious to explore the syntax > for doing what you suggest. But, first I just want to understand the > situations where arrays might be used, then find ways of doing it without > having to use an array. What kinds of situations would this include? > > I'm used to just using <cfoutput> to display query results, or filling > a select box with query results. But, I seem to remember hearing somewhere > that there was some situation where an array should be used, but I can't > remember where. > > I think I saw something, for instance, putting an array into a Session > variable. > But, again, I can't think of an example of when you would want to do this. > > Is there anything more you can tell me? I'm looking to be able to > identify particular kinds of situations. > > Thanks, > Lewis > > > > > On Thu, Sep 2, 2010 at 6:06 PM, Maureen <[email protected]> wrote: > >> >> A query basically is a type of structure, and can also be navigated >> like an array, so if you learn to navigate through the query using the >> row numbers and data elements, you can build pagination or most any >> other output without needed to load the query into an intermediate >> array or structure. >> >> On Thu, Sep 2, 2010 at 2:46 PM, Lewis Billingsley >> <[email protected]> wrote: >> > >> > Greetings, >> > >> > This is a general question and not for a specific project. I'm trying >> to understand when arrays would come in handy with capturing query restults >> as opposed to just using <cfoutput>. For instance, it may happen that you >> may need to move the results from one page to another. (Although, I don't >> know when you would need that.) But, in general, when would you need to use >> an array? And, when would you need to use a structure to capture query >> results? >> > >> > Thanks much in advance, >> > L >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5091 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm
