Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Change Sort order by using parameter Post Reply Post New Topic
Author Message
Hossam
Newbie
Newbie
Avatar

Joined: 31 Mar 2009
Location: Egypt
Online Status: Offline
Posts: 23
Quote Hossam Replybullet Topic: Change Sort order by using parameter
     Posted: 03 Apr 2009 at 5:48am

Hi all,

 

I have a report include 4 columns

ID

Name

Address

Birthday

 

How to change the sort order by using a parameter include the above report columns and end user can select which column need to sort by

 

 thanks , regards

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Apr 2009 at 6:54am
Create a parameter field to allow user to select the 4 items.
Create a formula field that inserts that data based on the paramter selection (if {paramter}="A" then ID else if paramter="B" then Name else...)
Insert the formula field as the the sort column.
IP IP Logged
Hossam
Newbie
Newbie
Avatar

Joined: 31 Mar 2009
Location: Egypt
Online Status: Offline
Posts: 23
Quote Hossam Replybullet Posted: 03 Apr 2009 at 6:56am

what is mean insert data based on the paramter selection

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 03 Apr 2009 at 7:20am

I mean create a formula field that will use the paramter field to conditionally change what appears in it based on the selection of the parameter. Here is an example. You will have to change it to actually look at the real data fields and paramter that you create:

if {?paramter}=Option A then {table.IDfield} else if {?paramter}=option B then {table.namefield} else
if {?paramter}=Option c then {table.Addressfield} else if {?paramter}=option D then {table.birthdayfield}
 
Since this field now will have the the data from the selected options you can just add a sort on this one field that dynamically resorts each time the parameter is changed.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum