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

How do you sort this?

Status
Not open for further replies.

stormtrooper

Programmer
Apr 2, 2001
266
0
0
CA
When I do a sort on a field this is what I get:
1, 10, 11, 12, 13, 14, 15, 2, 3, 4, 5, 6, etc.

What I want is:
1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, etc.
 
Create a formula that converts your field from text to numeric, and then sort on that formula field. Malcolm Wynden
Authorized Crystal Engineer
malcolm@wynden.net
 
an alternative to Malcolm's approach would be to pad the variable with spaces....Pick the maximum size of the number (say 5 digits)...then you can do this for a sorting formula or group on it for that matter

@SortVariable

spaces(5 - length({table.strValue))) + {table.strValue}



Jim
JimBroadbent@Hotmail.com
 
The easiest way is to write a formula that is:

Val({your.field}) and sort on that. You dont have to show the formula, just sort on it. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Oh, come on, the easiest way is to store numbers as numbers in the database in the first place :) Malcolm Wynden
Authorized Crystal Engineer
malcolm@wynden.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top