Solved

Crystal Reports alphanumeric sort problem

Posted on 2011-03-19
4
979 Views
Last Modified: 2012-08-13
Hi all-

I use CR 2008 and have a field called itemCode which is a string and has values like R1, R10, R2, R44.002, R300, R9 etc. The "R" is always present and always at the beginning.
I need to sort them numericaly so that the result is R1, R2, R10 etc.  Currently it sorts like R1, R10, R2 etc.  
I need a formula to truncate the "R" and cast it to a number and then I can sort on the formula value.

Any help would be greatly appreciated.
Thanks
0
Comment
Question by:chamlight
  • 2
  • 2
4 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 35172306
Try this idea

Create a formula
Val(Mid({itemCodeField},2)

Another way so you can keep the R

Left({itemCodeField},1) & CStr(Val(Mid({itemCodeField},2), "00000")

mlmcc

0
 

Author Comment

by:chamlight
ID: 35172430
mlmcc

Wow, that was fast.  Thanks, I'll try them.  BTW can you see any problems I might have with the following?


toNumber (replace ({chaProducts.itemCode},"R","",1,1,1))
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35172465
That should work as well

mlmcc
0
 

Author Closing Comment

by:chamlight
ID: 35172477
Thanks.  Your solution is more...elegant
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now