when you say you need to retain the original key name...how so?  a 2d array?
a structure?

Charlie

----- Original Message -----
From: "Morgan Senkal" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, May 20, 2004 2:56 PM
Subject: Re: Sort #FORM# by value?

> I suppose I should have given more information, sorry :-(  But to clarify:
I only want to pull out FORM values which are numeric and order those.  I
also need to somehow retain the key name associated to each value.  It's a
good start tho thanks much Charlie!  Perhaps you and I can fiddle with it
and see where we get...
>
> >Hi Morgan:
> >
> >Might be a better/more efficient way, but threw together a quick UDF
> >that seems to work:
> >
> ><html>
> ><head>
> > <title></title>
> > <meta http-equiv="Content-Type" content="text/html;
> >charset=iso-8859-1" />
> >
> > <cfscript>
> > function sortForm(stForm) {
> > var formValueArray = arrayNew(1);
> > var kArray = structKeyArray(stForm);
> >
> > for (i=1; i LTE arrayLen(kArray); i=i+1) {
> >
> >formValueArray[arrayLen(formValueArray)+1] = stForm[kArray[i]];
> > }
> >
> > temp = arraySort(formValueArray, 'text');
> > return formValueArray;
> > }
> > </cfscript>
> ></head>
> >
> ><body>
> >
> ><cfparam name="form.field1" default="foo">
> ><cfparam name="form.field2" default="bar">
> ><cfparam name="form.field3" default="foobar">
> ><cfparam name="form.field4" default="barfoo">
> >
> ><cfdump var="#form#">
> >
> ><cfset formValueArray = sortForm(form)>
> >
> ><cfdump var="#formValueArray#">
> >
> ></body>
> ></html>
> >
> >Hope that helps.
> >
> >-----Original Message-----
> >From: Morgan Senkal [mailto:[EMAIL PROTECTED]
> >Sent: Wednesday, May 19, 2004 12:41 PM
> >To: CF-Talk
> >Subject: Sort #FORM# by value?
> >
> >
> >Any ideas?  You would think that StructSort would be the answer but
> >nope.
> >
> >TIA!
> >
> >-Morgan
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to