Solved

Crystal Reports: Select Group Sort Field at Runtime

Posted on 2014-11-26
8
696 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Insert timestamp data field of max summary 8 39
Crystal Report Date Range Parameters 2 52
Crystal Reports 13 5 45
Visual Studio .Net 2012 and Crystal Reports 9 49
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. …
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 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

18 Experts available now in Live!

Get 1:1 Help Now