Solved

Arrange number ID's in sort

Posted on 2010-11-07
1
314 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

695 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