Something like this :
<cfloop collection=form item=ii>
<cfif find(ii,"Q")>
<cfset NumberOfQs = NumberOfQs + 1>
</cfif>
</cfloop>
<cfloop from=1 to=NumberOfQs index=i>
<cfset currntQ = "Q" & i>
do what ever...
</cfloop>
or use NumberFormat to name your field like
001
002
003
...
010
011
WG
-----Original Message-----
From: Ewok [mailto:[EMAIL PROTECTED]
Sent: 07 March 2003 13:23
To: CF-Talk
Subject: Sorting a form collection?
Is it possible to sort a collection, particularly the form collection??
All my form fields are created dynamically and are named such as
Q1
Q2
Q3
Q4
..
..
Q10
Q11
Etc.
When I loop the collection they are returned in the good old alphabetical
order
i.e.
Q10
Q11
Q12
Q13
Q9
Q8
I just wanted to know if there was easy way to do this before I started
building it to create a list, removing the Q and sorting chronologically
then looping that. especially since the collection has the potential to get
rather large.
Also, I didn't want to put 0's in front of single digit numbers since they
are unique ID's of rows in my database table.
So, is there a function to sort a collection like you can with lists using
listsort() ?
or even....is there a way to make access use 01, 02 when auto incrementing
with an autonumber datatype?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4