The easiest way is simply to use numeric keys: 1,2,3,4.... (you'll need t
o
use StructInsert and the
MyStruct[key] format.

Then, you can simply go

<cfloop from="1" to="#StructCount(MyStruct)#" index="Key">

So easy.

----- Original Message -----
From: "Simon Horwith" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, February 26, 2002 9:05 AM
Subject: RE: Structure ordering


> arrays and stacks do this (stacks are not defined as a data object type
> in
> CF), but not structures.  Just the nature of the beast.
>
> ~Simon
>
> Simon Horwith
> Macromedia Certified Instructor
> Certified Advanced ColdFusion 5 Developer
> Fig Leaf Software
> 1400 16th St NW, # 500
> Washington DC 20036
> 202.797.6570 (direct line)
> www.figleaf.com
>
>
>
> -----Original Message-----
> From: Neil Clark [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 25, 2002 2:58 PM
> To: CF-Talk
> Subject: Re: Structure ordering
>
>
> Dave,
>
> As with the previous mail, a correct order in a structure I would say
> should
> be as you insert them, but I think the ability to order a structure
> should
> be in CF (as it would save me time! :-)
>
> Neil
>
>
> ----- Original Message -----
> From: "Dave Watts" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Monday, February 25, 2002 6:51 PM
> Subject: RE: Structure ordering
>
>
> > > I have a structures which is a basic Key = Value pairs setup
> > > which tends to follow the pattern of :
> > >
> > > objectid1, objectid2, objectid3 etc...
> > >
> > > however, in some instances I have more than 10 Objects in a
> > > structure and they NEED to be in the correct order within
> > > the structure. When it is more than 10 is does this;
> > >
> > > objectid1, objectid10, objectid11 etc... and it does not keep
> > > the correct ordering.
> > >
> > > It is probably staring me in the face, but anyone know of a
> > > good way to keep them in the order I wish? eg.
> > >
> > > objectid1,objectid2, objectid3 ... objectid100 etc..
> >
> > There is no "correct" ordering within a structure, as Ray mentioned.
> A
> > structure is like a bag. You put things in the bag, you take them
> out, but
> > you don't generally order them within the bag itself. After all, what
> would
> > a "correct" ordering be? Sequential (in order of insertion) or
> alphabetized
> > by key, or alphabetized by value?
> >
> > However, in your case, you can get the ordering you want by making
> sure
> that
> > you use key names that follow the alphabetical order you want. Just
> name
> > your keys "objectid001", "objectid002" and so on, if you expect to
> have
> less
> > than one thousand keys. If you do this, you'll get the ordering you
> want,
> > although there's no guarantee that future versions of CF will return
> keys
> in
> > alphabetical order (and it's worth noting that not all versions of CF
> have
> > used alphabetical ordering in the past, I don't think).
> >
> > Dave Watts, CTO, Fig Leaf Software
> > http://www.figleaf.com/
> > voice: (202) 797-5496
> > fax: (202) 797-5444
> >
>
> 
______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
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

Reply via email to