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!

Specific Sorting by common beginnings

Status
Not open for further replies.

walshut

Technical User
Feb 19, 2002
4
US
I am trying to sort my report in a specified order. I am dealing with unique asset numbers and need them to show up on the report in a specific order. Example:

First #'s... (1234-9999)
then all numbers with a "0S" in front (0S1234-0S9999)
then all numbers with a "0X" in front (0X1234-0X9999)
then all numbers with a "S" in front (S01234-S9999)
then all numbers with a "X" in front (X01234-X9999)

By sorting the report by ascending or descending I can not achieve my desired order. So I have been attempting at using specified order. But the limitation here is that I can not select:

first (all integers)
first all numbers with (all starting with "0S")
first all numbers with (all starting with "0X")
first all numbers with (all starting with "S")
first all numbers with (all starting with "X")

The only way I see that I can use specified sort is to pick each number in the order that I need. Is there a way to pick by commonalities?

Any other suggestions?
 
try grouping on this formula

I'll assume this is a one field and it is a string

@grouping

if isnumeric(left({Table.value},1)) then
"1"
else if Left(left({Table.value},2) = "OS" then
"2"
else if Left(left({Table.value},2) = "OX" then
"3"
else if Left(left({Table.value},2) = "S" then
"4"
else if Left(left({Table.value},2) = "X" then
"5"
else
"6"; // a catch-all in case there other formats

hope this works for you

Jim
JimBroadbent@hotmail.com
 
I've used the specified sort with dates since our database stores them as YYYYMMDD. I want list files by their date in decending order. Using the specified order, I create a group named "Year 2001" and the criteria is that DATE "startswith" 2001.
 
You select all integers by doing an "is between" 0 and 9 for your first group. With text, saying between 0 and 9 is the same as saying starts with any integer. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top