Solved

Crystal Reports - User Input for Sort

Posted on 2013-05-21
6
208 Views
Last Modified: 2013-05-28
Hi there,

I have a request to create two sorts;

One is either ascending or descending by last name and the other is to choose either ascending or descending by amounts called ratings.

When the user runs the report, he/she would like to be asked to choose on of the options, ascending or descending for each.  I have played around with this and have reviewed some other cases but none seem to touch upon this.  

Any advice? Thank you in advance,
CS
0
Comment
Question by:rporter45
  • 3
  • 2
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Is that to sort on a single field?

Are the fields the same datatype? ie both are text/string?

mlmcc
0
 

Author Comment

by:rporter45
Comment Utility
Hi there,

There are two fields - the first is a field called sort name - this is a string.

The second option they would like is to sort by rating that is currency.

They would like one or the other but not both at one time.

Thank you -
CS
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 350 total points
Comment Utility
2 parmaeters and 4 formulas

Parameters
SortFIeld - allow use r to choose the field
SortOrder - Allow user to specify sort direction

Formulas
Name - Sort1
If {?SortOrder" = "A" and {?SortField} = "Rating" then
    {RatingField}
Else
    0

Name Sort2
If {?SortOrder" = "D" and {?SortField} = "Rating" then
    {RatingField}
Else
    0

Name Sort3
If {?SortOrder" = "A" and {?SortField} = "Name" then
    {NameField}
Else
    "A"

Name Sort2
If {?SortOrder" = "D" and {?SortField} = "Name" then
    {RatingField}
Else
    "A"

Add the sort formulas to the report sorting
Set SORTs 2 and 4 to DESCENDING

mlmcc
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:rporter45
Comment Utility
Thanks! I will try these out and get back to you,

take care,
CS
0
 
LVL 22

Expert Comment

by:Ido Millet
Comment Utility
If you are using a recent version of Crystal, it provides an option to attach sort controls to column headers.  See Crystal online help topic of "Sort controls".
0
 

Author Closing Comment

by:rporter45
Comment Utility
Worked perfectly!
Thank you -
CS
0

Featured Post

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

Join & Write a Comment

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 …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

772 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

10 Experts available now in Live!

Get 1:1 Help Now