<cfquery name="data" datasource="MyDSN">
SELECT *
FROM MyTable
</cfquery>

<cfif IsStruct(data)>
        data is a struct<br>
<cfelseif IsQuery(data)>
        data is a query<br>
</cfif>

<cfif IsArray(data[listfirst(data.columnlist)])>
<cfoutput>
        data[#listfirst(data.columnlist)#] is array<br>
</cfoutput>
</cfif>

In CFMX tells you that "data" is a query and NOT a structure and that
data[columname] is an array.

Paul

> -----Original Message-----
> From: Simon Horwith [mailto:[EMAIL PROTECTED] 
> Sent: 13 June 2003 14:24
> To: [EMAIL PROTECTED]
> Subject: RE: [ cf-dev ] Extracting values from a returned query
> 
> 
> actually, to be clear, recordsets are just that - recordsets. 
>  Arry and structure functions are not able to manipulate 
> them.  That said, you can use structure and array notation AS 
> IF they are a structure of arrays, as Stephen said.
> 
> ~Simon
> 
> Simon Horwith
> CTO, Etrilogy Ltd. 
> Member of Team Macromedia
> Macromedia Certified Instructor 
> Certified Advanced ColdFusion MX Developer
> Certified Flash MX Developer
> CFDJList - List Administrator
> http://www.how2cf.com/
> 
> 
> -----Original Message-----
> From: Steve Martin [mailto:[EMAIL PROTECTED]
> Sent: 13 June 2003 14:20
> To: [EMAIL PROTECTED]
> Subject: RE: [ cf-dev ] Extracting values from a returned query
> 
> 
> Are they _actually_ arrays of structs in MX? I know they were 
> conceptually and that array like notation can be used to 
> reference recordsets, but with CF5 and below this was purely 
> a convenient way of accessing records out of turn and that 
> they weren't really arrays.
> 
> Steve
> 
> 
> > -----Original Message-----
> > From: Stephen Moretti [mailto:[EMAIL PROTECTED]
> > Sent: 13 June 2003 14:19
> > To: [EMAIL PROTECTED]
> > Subject: Re: [ cf-dev ] Extracting values from a returned query
> > 
> > 
> > Karl,
> > 
> > Don't forget that query recordsets are structures of arrays.
> > 
> > A struct for each column and an array in each column struct
> > for the rows
> > returned.
> > 
> > You can reference a query like this
> > 
> > myQuery["mycolumnname"][rownumber]
> > 
> > regards
> > 
> > Stephen
> > 
> > 
> > ----- Original Message -----
> > From: "Osullivan Karl (RKB) Senior Analyst/Programmer"
> > <[EMAIL PROTECTED]>
> > To: "CF - Development Group" <[EMAIL PROTECTED]>
> > Sent: Friday, June 13, 2003 12:24 PM
> > Subject: [ cf-dev ] Extracting values from a returned query
> > 
> > 
> > >
> > >
> > >
> > > Hello,
> > >
> > > I've got a query that returns two columns: Heading and
> > Value.  The Heading
> > > column contains a heading to be printed in the report (eg
> > Consultant) and
> > > the value column contains the name of the consultant (eg Dr
> > Smith).  Each
> > > query returned contains several rows (each with headings
> > and values), but
> > > the returned order is not the order I wish to display them
> > on screen.
> > >
> > > Is there an easy way to search through the query to find
> > the heading, for
> > > example, "Report_Title", and then output the value.  I'm
> > trying to do it
> > > without using lots of <CFQUERY> tags.  Can I get my query
> > into a structure
> > /
> > > array?  Would this help?
> > >
> > > Thanks.
> > >
> > > Karl
> > >
> > >
> > > Karl O'Sullivan
> > > Senior Analyst/Programmer
> > >
> > > Computer & Network Services
> > > UHCW NHS Trust
> > > Clifford Bridge Road
> > > COVENTRY
> > > CV2 2DX
> > >
> > > Contact:
> > > Tel (internal): 28952
> > > Tel (external): +44 (0) 24 7696 8952
> > > Email: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> > Web: www.uhcw.nhs.uk <http://www.uhcw.nhs.uk>
> >
> >
> >
> >
> >
> >
> 
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED] For human help, e-mail: 
> [EMAIL PROTECTED]
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED] For human help, e-mail: 
> [EMAIL PROTECTED]
> 
> 
> 
> 



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to