Crystal Reports & SQL Reporting Services Training Consultants
Account Log in:
Username:
Password:
Believe in yourself so others will too
 
Institute of IT Trainers - Freelance Trainer of the Year 2006 & 2009
Liverpool Business Connect Member
  Maximum Impact Solutions Limited - Reporting Solutions, Creating Answers
Reporting Solutions - Creating Answers, Crystal Reports, Dashboarding (Xcelsius) & SQL Reporting Services

The Maximum Impact Solutions Blog Feed ME!!!!

01
July

How Do I Sort the Numbers in a Text Field in the Correct Order in Crystal Reports??

A client recently asked me how to sort numbers in a text data field correctly in Crystal Reports XI.

The Address table of the database, holds the address in a number of fields:
  • {Address.Number} - Holds the door or flat number
  • {Address.Address 1} - Holds the 1st line of the address
  • {Address. Address2} - Holds the 2nd line of the address
When the address fields are added to the report, the records are displayed in the incorrect order.


Solution:

  1. Create a formula, called Sort Order:

  2. IIf(Val(Right({Tablename.FieldName},1))=0,Right({TableName.FieldName},1),"")

  3. Create a second formula, called Sort Order 2:

    Val({Tablename.FieldName})

  4. From the Report menu, select the Record Sort Expert option

  5. In the Record Sort Expert dialog box, add the following Fields:

    • {@Sort Order}
    • {Address.Address 1}
    • {Sort Order 2}

  6. Press the OK button

  7. Refresh the report


If you have any questions, leave us a comment below, or need any assistance, please do not hesitate to Contact Us

MAKE A COMMENT

Name *

Email Address *

Comment *