Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Bryan Ashcraft ::TMM:: #1
Sorting a Structure
I must be missing something as I can't seem to figure out how to sort
a structure based on the key name, not key value. I'm trying to create a
universal email cfc that will take the fields submitted via a form and
generate an email. The problem is the email isn't returning the values
in the desired order. I have added extra letters/numbers to the
beginning of the form names and tried using the structSort function but
it still doesn't work. For example I have tried using A-First_Name,
B-Last_Name, etc., as well as, 1-First_Name, 2-Last_Name, etc. Any ideas?
Here is the base code:
<cfif isDefined("arguments.submit")>
<cfset structDelete(arguments,"submit")>
</cfif>
<cfif isDefined("arguments.fieldnames")>
<cfset structDelete(arguments,"fieldnames")>
</cfif>
<cfmail to="emailAddress" from="#arguments.name# <#arguments.email#>"
subject="#arguments.subject#">
<cfset structDelete(arguments,"subject")>
<cfloop collection="#arguments#" item="keyValue">
#replace(keyValue,"_"," ","all")#: #structFind(arguments,keyValue)#
</cfloop>
</cfmail>
Thanks in advance.
--
Bryan Ashcraft (remove brain to reply)
Macromedia Certified Dreamweaver Developer
Paragon Visuals :: [url]http://www.paragonvisuals.com[/url]
TMM Volunteer (DW) :: [url]http://www.macromedia.com/go/team/[/url]
~~~~~~~~~~~~~~~~~~~~~~~~
Got Questions? Get Answers
DWFAQ :: [url]http://www.dwfaq.com[/url]
PVII :: [url]http://www.projectseven.com/go/[/url]
--
Bryan Ashcraft ::TMM:: Guest
-
Sorting array vs sorting paginated array
....pulling in a long list of photos in a gallery, and I have a sort function working within the pages of data fine. I need to bring it back out of... -
Class::Struct - want to access structure within structure
I want to access a structure within a structure. Below is what I had in mind. Please help. #!/perl/bin/perl use Class::Struct; struct Step... -
Add to Structure
I'm a structures newbie. I need to know how to 1) Determine if a structure already exists 2) If not, create it. If yes, add to it. I've got... -
Sorting an Array containing a structure...
I a loop nested in a loop that drives a query that kind of walks backwards out by a commodity classification then by region classification... so... -
W3D structure...
Hi My big problem is that I have some deformations that are already defined by vertices index, and their moves... But these deformations are... -
BSterner #2
Re: Sorting a Structure
You could do something like...
<cfloop list="#ListSort(StructKeyList(arguments), "text", "ASC")#" index="keyValue">
#replace(keyValue,"_"," ","all")#: #arguments[keyValue]#
</cfloop>
BSterner Guest
-
Jay #3
Re: Sorting a Structure
1. Use structKeyArray() to create an array of the struct keys
2. User arraySort() to sort the array
3. You can then use a cfloop to loop through the array and reference the struct on each loopJay Guest



Reply With Quote

