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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort Complex Data

Status
Not open for further replies.

fallsr

Programmer
May 5, 2003
16
US
I am working in Crystal XI against an Oracle database. I need to sort my data alpha-numerically. I have a lot of different combinations of alpha and numeric data. The data is drawing numbers for old facilities where there are often up to 100,000 rows to be sorted. Example:
5A90-1
5A90-2
5A90-12
5A90-15
5A90-28
5A90-95
5A90-146
5A90-175-001
5A90-175-002
5A90-175-003
5A90-175A-001
5A90-175B-001
5A90-175C-001
5A90-175C-002
5A90-175C-003
5A90-175C-003A
5A90-175C-003D
5A90-175C-003M
5A90-175C-003M/9AS61B
5A90-175C-003M/9AS61L
... and so on. The first five characters are manageable but starting with position six I am not able to get the data to sort as I need it to.

I have tried this:

Stringvar MyString:=Mid({Command.DRAWING_NUMBER},6);
Stringvar SOutput;
numbervar x;

SOutput := " ";

for x := 1 to len(MyString)
do (
if Not(NumericText(mid(MyString,x,1))) then
SOutput:= SOutput + mid(MyString,x,1);
);
SOutput;

... but this is not working as I would expect. Any help is greatly appreciated.





Thanks,
Bob
 
We need a little more information. What do you expect? And what are you getting?

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
What I need or expect is that the data be sorted alpha-numerically from position 6 and beyond. The code I found tends to ignor "-" and other special characters. What I am getting is almost what I need except that the default sort is an alpha sort so numbers do not order properly. I don't know how to explain it further.

Thanks,
Bob
 
It's alphanumeric, so it sorts alphanumeric.

I know of no program or utility that does what you expect, why do you expect this?

You might create a series of formulas to sort by, some numeric, some alpha, but that would rely on fields being consistent in the layout.

-k
 
Thanks for the input. Your response confirms my understanding that there is no good solution. Unfortunately, the format of the data wanting to be sorted is very inconsistent. The expectation is from the client as they need to be able to identify available number sequences to assign to new drawings. Without a good sort, they cannot see this readily. Thanks again.

Thanks,
Bob
 
You could use REPLACE to change '-' to a Z or whatever.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top