Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to let user chose columns to sort? (CR 8) 1

Status
Not open for further replies.

KHerm

Programmer
Jan 9, 2001
80
0
0
US
In Crystal Reports 8 and 8.5, is it possible, when the user runs the report, to be able to select different columns to sort? I do know how to allow users to enter values to sort on, but it would be nice to be able to let them sort on name one time, or say, city another time.

Thanks!
 
Create a string parameter {?sort}, and then create a formula {@sort}:

Select {?sort}
case "Name": {table.name}
case "Date": totext({table.date},"yyyy/MM/dd")
case "ID" : totext({table.ID},"0000000")//where the number of zeros
//matches the maximum number of characters in the number field
default : ""

Then go to report->sort records and enter {@sort} as your sort field.

-LB
 
Thank you very much for your quick and "worked the first time" answer! So easy, really, but I don't think I could have found that solution without a lot of frustrating work. Much appreciated!

KH
 
One more question. If I need to have a sort within a sort (first last name then city, or city then last name) how would that be set up?

KH
 
Set up two sort parameters {?sort1} and {?sort2}. Then create two formulas {@sort1} and {@sort2} that are exactly like the formula I provided earlier, except substitute {?sort1} or {?sort2} for {?sort} in each. Then add {@sort1} and {@sort2} to report->sort records.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top