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 Chris Miller 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.

296097

Programmer
Aug 13, 2004
32
US
A400 01 AMERICAN PLUMBING CO OF WINONA INC 450 44TH AVE
DIST 6 01 DISTRICT ENGINEER 2900 48TH ST N W
E0038 01 EATON CONSTRUCTION RR 1 BOX 60
1338 01 GARY LOVELACE - R.E. 2900 - 48TH STREET N.W.
H438 01 HOFFMAN CONSTRUCTION COMPANY 123 COUNTY HWY A
IN DIS 01 INTER PROG MAIL STOP 440 MAIL STOP 440
M630 01 MINNOWA CONSTRUCTION INC 850 WICKETT DR N W


I am just wondering if there is a way in CR 8.5 to sort my records first by A LETTER followed BY A NUMBER and a special records like DIS 6 AND IN DIS AND
At the end number will be Acesendingly.if someone has an idea how I can tackle this problem please let me know .I really want my records to be sorted like the one
I have at the bottom. Your help is really appreciated

A400 01 AMERICAN PLUMBING CO OF WINONA INC 450 44TH AVE
E0038 01 EATON CONSTRUCTION RR 1 BOX 60
H438 01 HOFFMAN CONSTRUCTION COMPANY 123 COUNTY HWY A
M630 01 MINNOWA CONSTRUCTION INC 850 WICKETT DR N W
DIST 6 01 DISTRICT ENGINEER 2900 48TH ST N W
IN DIS 01 INTER PROG MAIL STOP 440 MAIL STOP 440
1338 01 GARY LOVELACE - R.E. 2900 - 48TH STREET N.W.

 
If I understand you correctly, then you could try something like:

if not({table.ID} in ["DIS 6","IN DIS"]) then
left({table.ID},1) + totext(val(mid({table.ID},2)),"0000") else
if {table.ID} = "DIS 6" then "Y" else
if {table.ID} = "IN DIS" then "Z"

This should put DIS 6 in the next to the last position, and "IN DIS" in the last position, and sort the other results alphabetically and then by value. This assumes that there is always 1 letter followed by a maximum of 4 digits in the {table.ID} field except for the two exceptions you indicated. If you have "Y's" and "Z's" in your ID field, then use "ZY" and "ZZ" instead (I think--can't remember whether numbers have priority over letters). If you have other kinds of results, you would have to adjust accordingly.

-LB
 
I responded to another post with a more global solution, if the only possibilities that could ever exist are what you've demonstrated here, this should work, otherwise it probably won't.

As LB stated, try not to post the same question numerous times. I've been away for quite some time and I see that this is now a BETA site (testing functionality live), so you may be posting numerous times because the site is so flakey.

-k
 
where do put this formula.pls bear with me i am fairly new to CR 8.5.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top