Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting

Status
Not open for further replies.

1LastTime

Technical User
Nov 6, 2002
9
US
Is there a way to sort large capture files with aspect?(100,000 or more lines)

ie.

6109998888 : misc data
6099988172 : misc data
5119997777 : misc data
6099998172 : misc data
5129990000 : misc data

etc

Sorted by the 10 digit number.
 
You could do this in ASPECT using a standard sort routine (bubble, quick, etc.) on the first part of the string, but I'm rusty on my sorting skills so I don't recall which would be best in this situation. It would likely be slow since you couldn't hold all 100,000 numbers in one array in an ASPECT script at the same time, which may necessitate using a couple additional temporary files to hold the interim results.


aspect@aspectscripting.com
 
It may be easier to import the file into a word processor or database package and sort it there. In Microsoft Word, you can go to the Table menu, choose Sort, and then sort by paragraphs, assuming each entry is read as a separte line.

In Access, you can import a text file, assign a primary key, and the data will be automatically sorted.

If either of these solutions sounds workable for you, I can provide more instructions.
 
Hello,

If you're trying to sort by the Number field alone, you're outta luck. Even the Long Value will not except that high of number.

Sorry

Hank
 
I am not entirely sure but I don't think there would be any problem in treating these numbers as floats which should give a full 14 digits of (decimal) range.
[note: as per aspect help it gives 15 decimal places but is limited to some value, so to ensure all digits can be all values, subtract one digit and you are assured of full range on to that many digits.]
Although normally used to allow for decimal numbers floats can be used for numbers without decimal portions gaining the extra digit capability.

If I am wrong and float causes problems:
To sort a number bigger than aspect handles with its built in data types you could split the text number into two (or more) portions of 9 digits or less.
[again note aspect integer and long both give 10 digits of range but up to a limited value so by subtracting 1 digit you get full range.]
[also note they appear to give the same ranges, so long provides no value that I can see]
After splitting the text number into parts then the data can be sorted (including the split numbers) starting with the first portion and continuing with the next portions.

A little programming but if you need it maybe worth it.

Of course exporting to excel sorting there and bringing it back could work but that presents it's own set of difficulties.

Hope these ideas help some. DT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top