Sorting a struct of structs?

2004-08-11 Thread Damien McKenna
I've got a structure of structures, e.g.:

Records[id123].id
Records[id123].name

etc.

I'd like to sort by the id123 field, e.g. in the order Records[id1], 
Records[id2], etc.

I tried StructSort but it gives this error:

The specified element id123 does not contain a simple value.
[snip]
112 : 			cfset Records = StructSort(Records) /

Any ideas?
-- 
Damien McKenna - Web Developer - [EMAIL PROTECTED]
The Limu Company - http://www.thelimucompany.com/ - 407-804-1014
Nothing endures but change. - Heraclitus
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: Sorting a struct of structs?

2004-08-11 Thread Barney Boisvert
This what you want?

cfloop list=#listSort(structKeyList(records), textnocase)# index=i
#records[i].id#: #records[i].name#br /
/cfloop

cheers,
barneyb

On Wed, 11 Aug 2004 12:43:16 -0400, Damien McKenna
[EMAIL PROTECTED] wrote:
 I've got a structure of structures, e.g.:
 
 Records[id123].id
 Records[id123].name
 
 etc.
 
 I'd like to sort by the id123 field, e.g. in the order Records[id1],
 Records[id2], etc.
 
 I tried StructSort but it gives this error:
 
 The specified element id123 does not contain a simple value.
 [snip]
 112 : cfset Records = StructSort(Records) /
 
 Any ideas?
 --
 Damien McKenna - Web Developer - [EMAIL PROTECTED]
 The Limu Company - http://www.thelimucompany.com/ - 407-804-1014
 Nothing endures but change. - Heraclitus
 

 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: Sorting a struct of structs?

2004-08-11 Thread Bryan Stevenson
Have you checked cflib.org for a UDF to handle this?

I know there is one for sorting an array of structures and vica versa...may be worth a looksee

Cheers

Bryan Stevenson B.Comm.
VP  Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: [EMAIL PROTECTED]
web: www.electricedgesystems.com

- Original Message - 
From: Damien McKenna 
To: CF-Talk 
Sent: Wednesday, August 11, 2004 9:43 AM
Subject: Sorting a struct of structs?

I've got a structure of structures, e.g.:

Records[id123].id
Records[id123].name

etc.

I'd like to sort by the id123 field, e.g. in the order Records[id1], 
Records[id2], etc.

I tried StructSort but it gives this error:

The specified element id123 does not contain a simple value.
[snip]
112 : cfset Records = StructSort(Records) /

Any ideas?
-- 
Damien McKenna - Web Developer - [EMAIL PROTECTED]
The Limu Company - http://www.thelimucompany.com/ - 407-804-1014
Nothing endures but change. - Heraclitus
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: Sorting a struct of structs?

2004-08-11 Thread Damien McKenna
On Aug 11, 2004, at 12:52 PM, Barney Boisvert wrote:
 cfloop list=#listSort(structKeyList(records), textnocase)# 
 index=i
#records[i].id#: #records[i].name#br /
 /cfloop

You're a star Barney!Thanks.
-- 
Damien McKenna - Web Developer - [EMAIL PROTECTED]
The Limu Company - http://www.thelimucompany.com/ - 407-804-1014
Nothing endures but change. - Heraclitus
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: Sorting a Struct of Structs on multiple fields. Ideas?

2003-12-22 Thread Jim Davis
Just trying again on this. no responses the first pass.

 
_

From: Jim Davis [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 19, 2003 1:05 PM
To: CF-Talk
Subject: Sorting a Struct of Structs on multiple fields. Ideas?

 
While StructSort() works great for returning an array of keys sorted on a
single field, I would like to sort on multiple fields.

For example I've got a structure (actually a collection CFC) containing
structures (actually domain CFCs of the same type).I would like to sort on
two properties in the structs: BeginTime and EndTime.

Just for now I think it's easiest forget that we're talking about CFCs (but
understand that since we are using a different data store, like a query,
really isn't an option).

Actually getting the job done isn't all that hard... but I'm looking
specifically for the best way to do it.Both the most flexible (it should
allow for one or more properties and sort types to be specified) and as fast
as possible.

I'm just looking for ideas... I've considered some odd things that would
work (for example constructing a query of the properties and keys and
offloading the sort to QoQ) but before I get neck deep into it I'd like some
other ideas.

In the end I want to construct a root collection component from this that
will allow easy creation of domain specific collection components.For
example an employeeCollection component might extend this one and contain
instantiated employee components.Using this sort it might feature a
getSortedByLevelAndSalary() method.

Does any of this make sense outside my head?;^)

Thanks,

Jim Davis
_
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Sorting a Struct of Structs on multiple fields. Ideas?

2003-12-19 Thread Jim Davis
While StructSort() works great for returning an array of keys sorted on a
single field, I would like to sort on multiple fields.

For example I've got a structure (actually a collection CFC) containing
structures (actually domain CFCs of the same type).I would like to sort on
two properties in the structs: BeginTime and EndTime.

Just for now I think it's easiest forget that we're talking about CFCs (but
understand that since we are using a different data store, like a query,
really isn't an option).

Actually getting the job done isn't all that hard... but I'm looking
specifically for the best way to do it.Both the most flexible (it should
allow for one or more properties and sort types to be specified) and as fast
as possible.

I'm just looking for ideas... I've considered some odd things that would
work (for example constructing a query of the properties and keys and
offloading the sort to QoQ) but before I get neck deep into it I'd like some
other ideas.

In the end I want to construct a root collection component from this that
will allow easy creation of domain specific collection components.For
example an employeeCollection component might extend this one and contain
instantiated employee components.Using this sort it might feature a
getSortedByLevelAndSalary() method.

Does any of this make sense outside my head?;^)

Thanks,

Jim Davis
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]