Well, you CAN write
MyQuery["FieldName"][2]
and you can even write
#ArrayMax(MyQuery["FieldName"])#
if FieldName is a numeric column. Cool huh?
Regards,
Matthew Walker
/*
Easier, smarter forms:
http://www.matthewwalker.net.nz/inform2
*/
> -----Original Message-----
> From: Dave Watts [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 30 May 2002 2:05 p.m.
> To: CF-Talk
> Subject: RE: Help with using query with [] notation
>
>
> > I know it's possible to do something like this:
> > MyQuery["FieldName"] (I know it's probably wrong, but
> > serves the purpose here)
>
> For the record, you can't do that, but you can do this:
>
> MyQuery.FieldName[i]
>
> to reference the column value at row i.
>
> > The CF Documentation does mention this somewhere, but doesn't
> > really go into detail. Does anyone know of any good links,
> > articles, or resources that describe this in more detail???
> > I'd prefer to understand this properly, rather than just find
> > the "solution" for my current situation. Not to mention that
> > it would be better if I can direct my coworkers and
> > subordinates to these resources as well....
>
> The only mention of it of which I'm aware is in the "Advanced
> ColdFusion
> Development" course offered by MM, but I suspect it's in the
> docs somewhere.
> However, there really isn't that much else to say about it,
> beyond the three
> lines near the top of the message. You can reference a
> column's value for a
> specific row using array notation.
>
> Of course, how you use this is up to you. For example, if you
> wanted to
> refer to the last row of a recordset, you could do it like this:
>
> MyQuery.FieldName[MyQuery.RecordCount]
>
> Or, you could use this feature to loop over the recordset in
> a CFSCRIPT
> block, since there's nothing analogous to the QUERY attribute
> of CFOUTPUT
> within CFSCRIPT:
>
> <cfscript>
> for (i = 1; i lte MyQuery.RecordCount; i = i + 1) {
> WriteOutput(MyQuery.FieldName[i] & "<br>");
> }
> </cfscript>
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> voice: (202) 797-5496
> fax: (202) 797-5444
>
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists