Solved

Crystal Reports: Select Group Sort Field at Runtime

Posted on 2014-11-26
8
674 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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 …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now