Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Crystal Report Sorting on Multiple fields

Posted on 2013-11-11
2
Medium Priority
?
514 Views
Last Modified: 2013-11-14
Hello,
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}
 else
If {?Sorting Choice}= 'Physician' 
then {@Doc}
else
if {?Sorting Choice} ='Room'
then {@room}
else
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.
0
Comment
Question by:Star79
2 Comments
 
LVL 101

Accepted Solution

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

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

Open in new window



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

Open in new window


mlmcc
0
 
LVL 35

Expert Comment

by:James0628
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.).

 James
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

877 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