Ask a Question related to ASP, Design and Development.
-
Bob Barrows #1
Re: Can you return the names of the form elements?
Robb Meade wrote:
One way is to use a bubble sort, which will give acceptable performance on> "Ray at <%=sLocation%>" wrote ...
>>>> Note that these fields will not be returned in any controllable
>> order.
> Cheers Ray thats grand...
>
> Know of anyway to sort an array? :)
>
> Robb
small (>100) data sets.
dim ar, i , j, vTemp
ar=array(dog,cat,bird,monkey)
response.write "Before Sort:<BR>"
for i = 0 to ubound(ar)
response.write ar(i) & "<BR>"
next
for i=0 to ubound(ar)-1
for j = i+1 to ubound(ar)
if ar(j) <= ar(i) then
vTemp = ar(j)
ar(j) = ar(i)
ar(i) = vTemp
end if
next
next
response.write "After Sort:<BR>"
for i = 0 to ubound(ar)
response.write ar(i) & "<BR>"
next
To sort numbers, change "if ar(j) <= ar(i) then" to "if cdbl(ar(j)) <=
cdbl(ar(i)) then", or cint, clng, etc., depending on what type of numbers
you are sorting.
Another way is to use an ad hoc recordset:
dim ar, i , rs
ar=array(dog,cat,bird,monkey)
response.write "Before Sort:<BR>"
for i = 0 to ubound(ar)
response.write ar(i) & "<BR>"
next
Set rs=server.createobject("adodb.recordset")
'again, use the datatype that makes sense for your data
rs.fields.append "data",adVarChar,20
rs.open
for i = 0 to ubound(ar)
rs.addnew "data", ar(i)
next
rs.sort "data"
i=0
do until rs.eof
ar(i) = rs(0)
i=i+1
loop
rs.close
set rs=nothing
response.write "After Sort:<BR>"
for i = 0 to ubound(ar)
response.write ar(i) & "<BR>"
next
HTH,
Bob Barrows
Bob Barrows Guest
-
#39365 [NEW]: getElementsByTagNameNS() does not return elements in a default namespace
From: z_rules55 at hotmail dot com Operating system: WinXP Professional PHP version: 5.2.0 PHP Bug Type: DOM XML related Bug... -
Add form elements into DB
Hi, I'm a complete newbie to Coldfusion!! Anyway I have a query, what I have is a form and what I have done is created a loop so that the... -
Loop Indexes in Form Names
See the following code: I have form input tag names generate by a loop. For instance: <!--- Page 1 ---> <cfset i=1> <cfoutput> <cfloop... -
form button names as variables
perhaps I am just a little tired, but I am having trouble with my form buttons. Firstly I name them like this name=\"round".$counter."heats\"... -
My webservice WSDL doesn't return any information about the elements.
If I go to the following public service WSDL @ http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx?WSDL I see the following...



Reply With Quote

