• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 51
  • Last Modified:

Crystal Report Sort Formula

I have a Crystal Report formula for a parameter I enter.  The first two work great, number three is not sorting how I want it.

It is sorting it like below:

0
1
2
3
4

I would like it sorted like:

20
19
18
17
16

The formula is below:

if {?SortColumns} = '1' then {Command.findname} else
if {?SortColumns} = '2' then {Command.lendercode} else
if {?SortColumns} = '3' then totext({Command.age},"00",0)

I want option number three to sort descending.  What in the world am I doing wrong?

Thank you in advance.
0
ldhon
Asked:
ldhon
1 Solution
 
mlmccCommented:
You only have 1 sort field.  There is no way to change from ascending to descending

Try this idea.  Use 2 formulas.  Set one to be ascending and the other to be descending

AscendingSort
if {?SortColumns} = '1' then 
    {Command.findname} 
else  if {?SortColumns} = '2' then 
    {Command.lendercode} 
else  if {?SortColumns} = '3' then 
    " "

Open in new window


Descending Sort
if {?SortColumns} = '1' then 
    0 
else  if {?SortColumns} = '2' then 
    0 
else  if {?SortColumns} = '3' then 
    {Command.age}

Open in new window



Use them as the sorting formulas and set the order appropriately

mlmcc
0
 
ldhonAuthor Commented:
Thank you very much mimcc.  Your solution is greatly appreciated.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

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