It looks like you have to do StructNew within the loop for every iteration.
In your code you are only doing that once, for the first array element.
- Original Message -
From: Darren Adams [EMAIL PROTECTED]
!--- query the old newsroom database---
cfquery name=news datasource=newsadmin
I think you need to do it the other wat around - Structures can hold arrays,
I dont think arrays can store structures.
N
!-
Neil Clark
Senior Web Applications Engineer
XML / Cerebro
MCB Digital
Macromedia Alliance Member
Tel: 020 8941 3232
Fax: 020 8941 4333
e-mail:
According to the official Advanced Coldfusion Development course book you
can.
-Original Message-
From: Neil Clark [mailto:[EMAIL PROTECTED]]
Sent: 30 April 2001 16:10
To: CF-Talk
Subject: RE: Arrays and Structures storing query values
I think you need to do it the other wat around
[EMAIL PROTECTED]
-Original Message-
From: Neil Clark [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 30, 2001 11:10 AM
To: CF-Talk
Subject: RE: Arrays and Structures storing query values
I think you need to do it the other wat around - Structures can
hold arrays,
I dont think
]]
Sent: Monday, April 30, 2001 11:10 AM
To: CF-Talk
Subject: RE: Arrays and Structures storing query values
I think you need to do it the other wat around - Structures can
hold arrays,
I dont think arrays can store structures.
N
Darren:
I'm just starting to use structures in CF too, so I'm by no means an
expert, but the code appended below is what I've used to address the
task you asked about -- hope it helps !
-Gerry
Gerard T. Pauline
Mgr, Internet/DB Applications
Computer Systems, DoIT
Pace University
!--- query the old newsroom database---
cfquery name=news datasource=newsadmin dbtype=ODBC
select * from pressreleasetable
ORDER by pressreleasedate DESC
/cfquery
!---Setup an array with a structure ---
cfset oldnews = ArrayNew()
!---add others here later e.g. prsub,prcontent,date etc... ---
Subject: Re: Arrays and Structures storing query values
It looks like you have to do StructNew within the loop for every iteration.
In your code you are only doing that once, for the first array element.
- Original Message -
From: Darren Adams [EMAIL PROTECTED]
!--- query the old
I think you need to do it the other way around - Structures
can hold arrays, I dont think arrays can store structures.
No, arrays can contain structures, just as structures can contain arrays.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202)
Yep your correct !!
Also I needed to put a one in the ArrayNew() declaration.
Cheers !
-Original Message-
From: stas [mailto:[EMAIL PROTECTED]]
Sent: 30 April 2001 16:00
To: CF-Talk
Subject: Re: Arrays and Structures storing query values
It looks like you have to do StructNew within
sure they can, i do it all the time.
cfset astAuthors = arrayNew(1)
cfset astAuthors[1] = structNew()
cfset astAuthors[1].firstname = 'jeff'
cfset astAuthors[1].lastname = 'tapper'
cfset astAuthors[2] = structNew()
cfset astAuthors[2].firstname = 'ben'
cfset astAuthors[2].lastname = 'forta'
This is the CF forum, not the Spectra forum ;)
- Original Message -
From: Raymond Camden [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Monday, April 30, 2001 11:12 AM
Subject: RE: Arrays and Structures storing query values
MacroMedia Representitive
Doh. Just think the other way around is more suited? maybe not?
whatdoiknow!!! :-(
!-
Neil Clark
Senior Web Applications Engineer
XML / Cerebro
MCB Digital
Macromedia Alliance Member
Tel: 020 8941 3232
Fax: 020 8941 4333
e-mail: [EMAIL PROTECTED]
Yep !
Thats the fella
-Original Message-
From: Robert Segal [mailto:[EMAIL PROTECTED]]
Sent: 30 April 2001 16:20
To: CF-Talk
Subject: RE: Arrays and Structures storing query values
Code should look this:
!--- query the old newsroom database---
cfquery name=news datasource=newsadmin
UIN : 3679482
My ally is the Force, and a powerful ally it is. - Yoda
-Original Message-
From: Dave f [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 30, 2001 11:35 AM
To: CF-Talk
Subject: Re: Arrays and Structures storing query values
This is the CF forum, not the Spectra forum
-Original Message-
From: Neil Clark [mailto:[EMAIL PROTECTED]]
Sent: 30 April 2001 16:44
To: CF-Talk
Subject: RE: Arrays and Structures storing query values
Doh. Just think the other way around is more suited? maybe not?
whatdoiknow!!! :-(
!-
Neil
Darren,
Try looking at the problem differently. You can treat your query as
structure of arrays. If you do this you won't have to do any conversion
at all. Simply set up a for () or cfloop from to index loop and out
put only the values you want.
cfloop from=1 to=#news.recordcount# index=i
17 matches
Mail list logo