Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Sort order - blanks last Post Reply Post New Topic
Author Message
FreeriderUK
Newbie
Newbie


Joined: 16 Jul 2007
Location: United Kingdom
Online Status: Offline
Posts: 1
Quote FreeriderUK Replybullet Topic: Sort order - blanks last
    Posted: 16 Jul 2007 at 2:30am
Hi,
I have a customer report I want to generate. I have a field for each customer called "sequence" in which I put a number (although some customers will have this field blank)

Using the SQL ORDER BY statement, how can I get the report to sort by "sequence" first, then have those without this value afterwards?

When using "ORDER BY Sequence, Address" I get:

AAA -
BBB -
CCC -
FFF - 1
EEE - 2


But how do I get:

FFF - 1
EEE - 2
AAA -
BBB -
CCC -

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 16 Jul 2007 at 11:42am
Create a formula that looks something like this:
 
If IsNull({table.Sequence}) then 99999 else {table.Sequence})
 
For '99999' use a value larger than your sequence number could ever possibly be. 
 
Sort on this formula instead of on the field, but use the field itself in the report.
 
-Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.014 seconds.