[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Crystal Reports - User Input for Sort

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
rporter45
Asked:
rporter45
  • 3
  • 2
1 Solution
 
mlmccCommented:
Is that to sort on a single field?

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

mlmcc
0
 
rporter45Author Commented:
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
 
mlmccCommented:
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
rporter45Author Commented:
Thanks! I will try these out and get back to you,

take care,
CS
0
 
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
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
 
rporter45Author Commented:
Worked perfectly!
Thank you -
CS
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now