Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A second order sort with ASORT()
Message
From
03/07/2005 11:44:06
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
03/07/2005 10:54:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01028620
Message ID:
01028627
Views:
14
You can try to sort first by the least significant column, and then by the most significant column. I used this a while ago in some spreadsheet that didn't have multi-column sort capabilities, but this method relies on the assumption that data is not shuffled about more than is absolutely required for sorting - an assumption I can not vouch for. You might try it, though.

Another possibility is to add another column, which contains the combined key - with the same expression you would use for an index expression (i.e., convert everything to type "C", and use a fixed length).

>A second order sort with ASORT()
>--------------------------------------------------
>
>In the following command line, ADIR populates the
>
>"aFiles" array with all of the JPG files in the given folder.
>
>
>nFiles = ADIR(aFiles,"C:\2005_Digital_Pictures\*.jpg")
>
>
>The next line sorts the array by File Date.
>
>= ASORT(aFiles,3)
>
>
>However, it would be nice to have a second order sort
>by File Time (sorted first by File Date and then by File Time).
>
>I've got some ideas about how to do this, but was curious to see
>if someone has already done this.
>
>Thanks!
>Terry :)
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform