?
Solved

Crystal Reports: Select Group Sort Field at Runtime

Posted on 2014-11-26
8
Medium Priority
?
804 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
[X]
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
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 101

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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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 101

Accepted Solution

by:
mlmcc earned 1000 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 35

Assisted Solution

by:James0628
James0628 earned 1000 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 101

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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

801 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