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

Sort by multiple fields in parameters 1

Status
Not open for further replies.

Dominican1979

IS-IT--Management
Joined
Apr 30, 2008
Messages
108
Location
US
Hello Everyone,

I'm trying to figure out how to sort by multiple fields using parameters. Right now i have the following: I have a parameter field where the user can choose one option, but i would like to have several where they can sort by name, then by city, etc or by whatever combination they want. Also I would like the parameter field to have all blanks initially as default because right now, the default option that is filled in on the parameter is name. Thanks a lot for your help


if {?SortField} = 'Name' then {USASalesRepCustListMS.Name} else
if {?SortField} = 'City' then {USASalesRepCustListMS.City} else
if {?SortField} = 'State' then {USASalesRepCustListMS.State} else
if {?SortField} = 'Zip' then {USASalesRepCustListMS.Zip} else
{USASalesRepCustListMS.Zip}
 
Hi,

I do a similar grouping depending on what parameter value is selected. This is how I make mine work (V10):

Create 4 separate string parameters - Group Level 1, through Group Level 4, with pre-created pick list of values to match all the available options that the user would pick:

Name, City, State & Zip

Make a grouping formula to match each of the 4 parameters{@Group1} and put in your formula

if {?FirstGrouping} = "Name" then
{USASalesRepCustListMS.Name}
else
if {?FirstGrouping} = "City" then
{USASalesRepCustListMS.City}
else
if {?FirstGrouping} = "State" then
{USASalesRepCustListMS.State}
else
{USASalesRepCustListMS.Zip}

Repeat this formula for each group level, replacing {?FirstGrouping} parameter with {?SecondGrouping},{?ThirdGrouping} or {?FourthGrouping} as required.

Create groups using these Grouping formulas in the report, then depending on what the user selects, the report will be rearranged. Or if you want to use SORT instead of group, then just add each of these formulas to the sort order feature.

As for the parameter default being blank, Do you mean in Crystal or published in Enterprise or somewhere??

Hope that helps some,



regards

BB

*** Count your blessings not your problems******
:-)
 
Hi BeeBear,

Thanks a lot for your reply, I mean bean blank on Crystal. I will try what you said tomorrow at work and let you know how it works for me, thanks again :-)
 
Hi BeeBear,

Thanks a lot for your help, it works great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top