Crystal Report Sorting on Multiple fields

Posted on 2013-11-11
Last Modified: 2013-11-14
I have a report designed in Crystal11. The user will be selecting the sort choice1, sort choice 2.

The formula for the sort choice1 and 2 I have given is :

If {?Sorting Choice} = 'PatientName' 
then {@Patient Name}
If {?Sorting Choice}= 'Physician' 
then {@Doc}
if {?Sorting Choice} ='Room'
then {@room}
if {?Sorting Choice} ='bed'
then {@bed}

Open in new window

If I provide the record sort expert with sortchoice 1 followed by sort choice 2, will it sort the report first by choice1 and then by choice 2.

 Is there any other way to do multiple sorting without creating groups.
Question by:Star79
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
LVL 101

Accepted Solution

mlmcc earned 500 total points
ID: 39639439
To sort by 2 fields you need to have 2 sort formulas and use both in the sort expert

If {?Sorting Choice1} = 'PatientName' 
then {@Patient Name}
If {?Sorting Choice1}= 'Physician' 
then {@Doc}
if {?Sorting Choice1} ='Room'
then {@room}
if {?Sorting Choice1} ='bed'
then {@bed} 

Open in new window

If {?Sorting Choice2} = 'PatientName' 
then {@Patient Name}
If {?Sorting Choice2}= 'Physician' 
then {@Doc}
if {?Sorting Choice2} ='Room'
then {@room}
if {?Sorting Choice2} ='bed'
then {@bed} 

Open in new window

LVL 35

Expert Comment

ID: 39641241
I'm not sure what you're asking.  You say that the user will select "sort choice1, sort choice 2", implying two sort options, but your formula has one parameter ({?Sorting Choice}), with 4 different sort options.

 Do you _want_ to allow the user to select 2 different sort options, and have the report sorted by both of them (first one, and then the other), or do you have 2 sort formulas and you want to make sure that only one of them is used?

 As for "multiple sorting without creating groups", you only need groups for this if you want the records grouped by the "sort" fields/formulas, or if you're trying to sort groups (eg. you want to sort the report by patient, doctor, etc., and within that sort, you want to group the records by day to get daily totals for each patient, doctor, etc.).


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

623 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