• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 413
  • Last Modified:

Sort question

I have a group that is comprised of a concatenation of two fields. It's setup to sort ascending. One  record is special and needs to be listed first. How do I accomplish this ? I can single out the record by type.  

Barry thomson is special and needs to be listed first.

Group
Displayname & Rate (Sort Ascending)
-----------------------------------------------------------

Results
------------
Andrew Jackson 500
Andrew Jackson 600
Barry Thomson 700  (Is of type special)
Lisa Smith  200
0
mowit
Asked:
mowit
  • 2
  • 2
  • 2
  • +2
1 Solution
 
Jared_SCommented:
Try using this...

order by
case
when displayname like 'Barry Thomson' then 1
else 2
end,
Displayname & Rate asc
0
 
peter57rCommented:
In the group expert you can can change the sequence to 'In selected Order' .  You will then get a dialog where you can  place your required value first .  You then have to say that you want to leave Others in their own groups.
0
 
mowitAuthor Commented:
Peter, I thought about doing that but then it will display another group level. I just wanted the record to be listed first.

Jared_s - Is that SQL ? I'm looking for a solution within Crystal.
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
Jared_SCommented:
Sorry, I write most of my Crystal reports by adding a user command... force of habit.
0
 
Kurt ReinhardtCommented:
If you don't want to use Specified Order for grouping, then you'll have to do it at the detail level with a formula field.  Here's one example:

If
  DisplayName = 'Barry Thompson'
Then
  '1'&DisplayName
Else
  '2'&Displayname

Instead of sorting on the actual DisplayName field (which you can still display on the report), you'll sort on the formula field.  This will ensure Barry Thompson is always listed first and all others will still be sorted alphanumerically after him.
0
 
mlmccCommented:
In Crystal add a formula

Local StringVar SortOrder := 2;
If {DisplayNameield} = "Barry Thomson" then
    SortOrder := 1;

SortOrder & " " & {DisplayNameField} & {RateField}

Use that for the group
You can change what is displayed as the group name
Right click the group header in the left margin
Click Change Group
On the second tab you can specify a field to display
Display just the DisplayNameField or your formula

mlmcc
0
 
mowitAuthor Commented:
mlmcc: you never disappoint. :)
0
 
Kurt ReinhardtCommented:
Actually, Peter's original suggestion would not require an additional layer of grouping. You could have easily accomplished your goal with his suggestion.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now