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!

Sorting Based On Parameter

Status
Not open for further replies.

fbermudez

Technical User
Oct 22, 2003
14
0
0
US
Does anyone have an example of sorting based on a parameter field.

I would like the user to select how the report will be sorted. Either by Customer, or by Region, or by Sales, etc...

The book Crystal Reports Professional Results has example that I just do not understand.

Any help is greatly appreciated. Thanks!
 
Create a discrete, string parameter {?Sort} and set the defaults to: Customer, Region, Sales.

Then create a formula {@Sort}:

if {?Sort} = "Customer" then {table.custname} else
if {?Sort} = "Region" then {table.region} else
if {?Sort} = "Sales" then totext({table.salesamount},0,"")

Substitute your own field names, and make sure that all formula results are converted to strings. Go to Report->Sort Records and add {@Sort} as the sort field.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top