Solved

Crystal Reports: Select Group Sort Field at Runtime

Posted on 2014-11-26
8
724 Views
Last Modified: 2015-02-17
I have created a report that produces the "Top N" number of records based on a parameter field populated at runtime. I have two "summary" fields that I can select that will, in effect, control the group sort order; Sum of Quantity Ordered (this will sort the group by dollar amount) and Max of Item Number (this will sort the group by Item Number)...as shown below.

GroupSort.png
The problem is that my user will sometimes want the group sort to be by Sum of Quantity Ordered and sometimes by Max of Item Number.

Rather than deploying the report in two versions, I'd like to allow the user to select which group sort order he wants "this time." My first though was to create a boolean parameter field to test if that selection was set to True or False and then, under Group Expert>Options>Use a Formula as Group Sort Order, create a formula that tests the value of the parameter field. Unfortunately, Crystal did not allow me to use a summary field in the formula. Only the below fields are available for use there.

GroupSortFormula.png
My question is; how can I allow my user to select, at runtime, the group sort order he needs?
0
Comment
Question by:Bad_Fish
8 Comments
 
LVL 18

Expert Comment

by:vasto
ID: 40467758
There are 2 options , unfortunately both require 3rd party software.
1st option is to use Millet software DataLink viewer. As far as I know it has an option to group on click.
2nd option is to use R-Tag Report Viewer, it will allow you to retrieve the report data and group it, pivot it etc. You can see how R-Tag will be used in this video:
http://www.r-tag.com/Pages/Preview_Dashboard.aspx

I know that there is a video showing DataLink viewer too , but I cannot provide you a link.
0
 

Author Comment

by:Bad_Fish
ID: 40467852
It's unfortunate that this is not a native option in CR...as I'm sure there's a lot of need for this ability. Thank you very much for the tips.

I'll leave this open for a bit and, if no one can provide a native answer by 6:00 PM, I'll close it out then.

Thanks again!
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 40467912
Try this idea

Create 2 formulas

Cost Formula
If {?SortParameter} = "COST" then
    {Cost Field}
Else
     0

Units Sold
If {?SortParameter} = "SOLD" then
    {Sold Field}
Else
     0

Add summaries on both formulas as appropriate (SUM or MAX)
SOrt on both fields.
Only the one chosen will have values

mlmcc
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:Bad_Fish
ID: 40468023
That is, in essence, what I tried under Group Expert>Options>Use a Formula as Group Sort Order (I'm assuming that were you meant for me to try it). But, using your example field names...my code looked like this.

If {?SortOrder} = true then
    {Cost Field}
Else
    {Sold Field}

The problem is that neither {Cost Field} nor {Sold Field} are allowed to be used in that code block.  Only the fields listed in the red box of image 2 above are available to me in that area. No other fields, but those, can be used.

I think I'm out of options here but thanks again for the earlier tips.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 40468326
No.  I meant create the formulas as shown then summarize them and use those summaries for the sort order.  You will end up with 2 sorts on the group

mlmcc
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 250 total points
ID: 40468780
Do you actually need a Top N sort?  A Top N sort seems to be limited to sorting by 1 summary (which probably makes sense).  But if you actually want to see all of the groups, you can use the "All" option for the group sort, which will let you sort by more than 1 summary (as mlmcc suggested).

 If you do need a Top N sort, I think there's a way to handle that as well.

 James
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 40614627
I've requested that this question be closed as follows:

Accepted answer: 168 points for vasto's comment #a40467758
Assisted answer: 166 points for mlmcc's comment #a40467912
Assisted answer: 166 points for James0628's comment #a40468780

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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 …
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

789 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