Solved

Arrange number ID's in sort

Posted on 2010-11-07
1
304 Views
Last Modified: 2012-08-13
Experts,

I have a crystal report that I am sorting the Field_ID in ascending order, but it sorts it not like 1 thru 50.  It ends up looking like this.
S1_d
S10_d
S11_d

It should look like this.
S1_d
S2_d
S3_d

I know crystal Reports must have a way of doing this correctly.  If not,  I will have to make a new column in the database's table and name it ID#. The add alphabets to sort.  

ID#     FIELD_ID
A                   S1_d
B                   S2_d
C                   S3_d

Any thoughts?
   
USING CRYSTAL REPORTS 2008 and Oracle 10 G          

0
Comment
Question by:Maliki Hassani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 34081287
That's because your field is being sorted "alphabetically," and as such, "10" comes before "2". I can't test right now because I don't have access to Oracle, but you could try modifying your ORDER BY to something like:
ORDER BY CAST(REGEXP_REPLACE(Field_ID, '[^[:digit:]]', '') AS INTEGER)

Open in new window

0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

740 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