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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

group sort based on parameter 1

Status
Not open for further replies.

adhhealth

Programmer
Jul 1, 2004
165
0
0
US
crystal version 8

hi,
i have 3 groups in a report and each user needs a group sort by a different group, instead of creating 3 different reports can we sort using a parameter?
if user1 selects parameter "group1" then the report should be sorted by group 1 and so on,..



 
Set up a parameter called {?Sort} with descriptive options like "Amount", "Name", "Date" and then create a formula {@Group}:

if {?Sort} = "Amount" then totext({table.amt},"000000.00") else
if {?Sort} = "Name" then {table.name} else
if {?Sort} = "Date" then totext({table.date},"yyyy/MM/dd")

Then insert a group on {@Group}. I formatted the results so that they would sort correctly, but you could actually display the field itself instead of the group name, so it appears in the format you desire. You would place the field in the group section and then suppress it by using a conditional suppression formula like:

{?Sort} <> "Amount" //for {table.amt}, etc.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top