Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Suvi Joseph
  Where is Suvi Joseph?
 Bangalore
 India
 Suvi Joseph
 To: Suvi Joseph
  Where is Suvi Joseph?
 Bangalore
 India
 Suvi Joseph
 Tags
Subject: And....
Thread ID: 15861 Message ID: 16002 # Views: 5 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Sunday, October 06, 2002 2:15:05 PM         
   


> > > > > > > > Dear All,
> > > > > > > > I came to know from VFP Help we can sort two dimensional array using ASORT command. But really didnt understand how I go about it. I can have directory structure using ADIR(xfile,"*.*"). Now I want to sort this with file extension. How do I do that? Can anyone help me?
> > > > > > > > Thanks in advance
> > > > > > > > Regards,
> > > > > > > > Suvi Joseph
> > > > > > >
> > > > > > >
> > > > > > > Since extension isn't one of the fields that ADIR stores, you will need to first do a run though the filename and store a JUSTEXT() to an additional element of the array. Once that is done, sorting is as easy as ASORT(xdir,nColumntoSortBy).
> > > > > > >
> > > > > >
> > > > > > I am sorry. I didnt get what you are saying. is JUSTTEXT() a command?. From my understanding ADIR stores file extension too. If I say ?xfile(1,2). It shows some number. I thought that is extension stored in number and If I sort that column, I will get the the sorting by extension. wont I? And please tell me what is JUSTTEXT()? It shows an error message when I run this in command prompt.
> > > > > > Regards,
> > > > > > Suvi Joseph
> > > > >
> > > > >
> > > > > It is JUSTEXT only one T in the middle.
> > > > >
> > > > > It gives you just the extension of a filename.
> > > > >
> > > > > ~S
> > > > Thanks Steve!! What does the second column in ADIR store? When I type ?xfile(1,2) it gives some number.
> > > > Thanks once again.
> > > >
> > > > Regards,
> > > > Suvi Joseph
> > >
> > > ADIR Creates the following columns:
> > > 1 = File names Character
> > > 2 = File sizes Numeric
> > > 3 = Dates last modified Date
> > > 4 = Times last modified Character
> > > 5 = File attributes Character
> > >
> > > So you have been sorting the array on File Size.
> > >
> > > Simon Arnold.
> >
> > Oh...yes!! Thanks!!!
> > Regards,
> > Suvi Joseph
> > www.sssoftwares.com
> > Email:suvi@sssoftwares.com
>
> This is what I did to insert an extra column of 'extensions' in the directory list array. So that other Foxite users will take use of it.
>
> =adir(xfile,"*.*")
> =AINS(xfile,2,2)
> FOR i=1 TO alen(xfile,1)
> 	xfile(i,2)=JUSTEXT(xfile(i,1))
> ENDFOR 
> 

>
> Regards,
> Suvi Joseph
> www.sssoftwares.com
> Email:suvi@sssoftwares.com
And to sort the array with file extension:
=ASORT(xfile,2) 
Cheers!!:-)

Regards,
Suvi Joseph
www.sssoftwares.com
Email:suvi@sssoftwares.com

ENTIRE THREAD

ASORT() Posted by Suvi Joseph @ 10/2/2002 3:01:30 PM
RE: ASORT() Posted by Steve Bloodsworth @ 10/2/2002 3:43:18 PM
RE: ASORT() Posted by Suvi Joseph @ 10/3/2002 8:45:39 AM
RE: ASORT() Posted by Steve Bloodsworth @ 10/3/2002 2:56:47 PM
RE: ASORT() Posted by Suvi Joseph @ 10/6/2002 7:16:33 AM
RE: ASORT() Posted by Simon Arnold @ 10/6/2002 10:07:45 AM
Thanks Simon and Steve Posted by Suvi Joseph @ 10/6/2002 10:29:37 AM
The code Posted by Suvi Joseph @ 10/6/2002 11:05:56 AM
And.... Posted by Suvi Joseph @ 10/6/2002 2:15:05 PM