Hi Nick,
 
Request.write was in your original post - I copied and pasted lol :)
 
If there are only that many items then a quicksort won't be noticeably
quicker.
 
Another way to loop through an array in reverse is this (assuming it's a
0-based array) :-
 
For MySort = LBound(MyArray) to UBound(MyArray)
Next 'sorting
response.write MyArray(uBound(MyArray) - MySort)
Next 'files

Dan
 
________________________________

From: Driver, Nicholas [mailto:[EMAIL PROTECTED] 
Sent: 01 April 2005 00:28
To: [email protected]
Subject: [AspClassicAnyQuestionIsOk] RE: RE: Alternatives for a FOR,
NEXT loop


Hi Dan

I tried that, and it doesn't work (even after substituting request.write
with response.write (I assume this was a typo))

There should only be 5-10 files there, but maybe a quicksort would be
better. Except, I don't know what a quicksort is.

I'll google it and check learnasp.com but if I haven't responded by the
end
of the day, some extra help would be great.

cheers
Nick

   From: "Dan Powderhill" <[EMAIL PROTECTED]>
Subject: RE: Alternatives for a FOR, NEXT loop

If you're stepping using -1 you should have lBound first, like so :-

For MySort = LBound(MyArray) to UBound(MyArray) step -1
Next 'sorting
request.write MyArray(MySort)
Next 'files

How many files are you talking about here? A quicksort might be more
efficient, unless that's what you're doing in your for loop.

Dan

_______________________________

From: Driver, Nicholas [mailto:[EMAIL PROTECTED] 
Subject: Alternatives for a FOR, NEXT loop


Hi Guys

Here's the problem.

I've listed files in a directory on my server (using FSO) and am trying
to
sort the resulting list by loading the values into a array and then
sorting
the array.

I've used 

For Each File...
For MySort = LBound(MyArray) to UBound(MyArray)
Next 'sorting
request.write MyArray(MySort)
Next 'files

However, I can't get it to sort in descending order (the files names
have a prefix plus the date on which they were created) I've tried For
MySort = UBound(MyArray) to LBound(MyArray) Step -1

But that gives me an error (which I can't seem to replicate, sorry).
Also, the "step" isn't recolouring (in Dreamweaver) which suggests to me
that it's not being identifed as a reserved word.

So, my question is "What can I use instead of a For Next loop to sort an
array into descending order since the step method of the FOR NEXT isn't
working?"

If anybody has any ideas, I'd be extremely greatful.

peace
Nick

------------------------------------------------------------------------
--------
This E-Mail is intended only for the addressee. Its use is limited to
that
intended by the author at the time and it is not to be distributed
without the
author's consent. Unless otherwise stated, the State of Queensland
accepts no
liability for the contents of this E-Mail except where subsequently
confirmed in
writing. The opinions expressed in this E-Mail are those of the author
and do
not necessarily represent the views of the State of Queensland. This
E-Mail is
confidential and may be subject to a claim of legal privilege.

If you have received this E-Mail in error, please notify the author
and delete this message immediately.
------------------------------------------------------------------------
--------
!DEPTSTAMP1!


________________________________

Yahoo! Groups Links


*       To visit your group on the web, go to:
        http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
          
*       To unsubscribe from this group, send an email to:
        [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]
subscribe> 
          
*       Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> . 




[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to