Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Sorting Post Reply Post New Topic
Author Message
Kerkuk
Newbie
Newbie


Joined: 08 Dec 2011
Online Status: Offline
Posts: 22
Quote Kerkuk Replybullet Topic: Sorting
     Posted: 19 Jan 2012 at 3:42am
I have field called { command.effectiveDate} I want to sort this field but I only want to show the Date when there is Data and if it is blank (Empty) I do not want  to be shown.

Edited by Kerkuk - 19 Jan 2012 at 3:44am
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 19 Jan 2012 at 3:54am
First of all, in your Design view - right-click on the "Details" section and select "Section Expert...".
 
Find the checkbox described "Suppress (No Drill-Down)" and click the "X+2" button to the right of it.
 
Enter the following and press "Save and Close";
isnull({command.effectiveDate})
 
This will get rid of all entries where there isn't a date.
 
To sort by the date, goto Report > Record Sort Expert...
 
Add the {command.effectiveDate} field to the sort fields and choose the direction.
 
Regards,
Ryan.


Edited by rkrowland - 19 Jan 2012 at 3:56am
IP IP Logged
Kerkuk
Newbie
Newbie


Joined: 08 Dec 2011
Online Status: Offline
Posts: 22
Quote Kerkuk Replybullet Posted: 19 Jan 2012 at 5:03am
Thank You Ryan for your help . is there any way that the user can control the sorting? I mean can the user sort between two fields?
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 19 Jan 2012 at 5:09am

You could create a parameter field called "Sorting Method" with 2 static values;

Effective Date
Other Sorting Option
 
Then create a formula field, for example's sake we'll call it "Sort by".
 
In that formula enter the following;
 
 
if {?Sorting Method} = "Effective Date"
then {command.effectiveDate}
else {table.otherfieldoption}
 
 
Then in your record sort expert remove the {command.effectiveDate} field and add the {@Sort by} field we just made.
 
Regards,
Ryan.


Edited by rkrowland - 19 Jan 2012 at 5:10am
IP IP Logged
Kerkuk
Newbie
Newbie


Joined: 08 Dec 2011
Online Status: Offline
Posts: 22
Quote Kerkuk Replybullet Posted: 19 Jan 2012 at 5:23am
Can you tell me how to create A parameter called"Sorting Method" with 2 static values
 
I have Effective Date and Expiration Date
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 19 Jan 2012 at 5:29am
In the Field Explorer, right-click Parameter Fields and click New.
 
Enter the following;
Name: Sorting Method
Value1 (Click here to add item): Effective Date
Value2 (Click here to add item): Expiration Date
Value Options: Allow Custom Values = FALSE and Allow Multiple Values = FALSE.
 
Ok that and make the formula as above replacing "else {table.otherfieldoption}" with "else {command.expirationdate}"
 
Regards,
Ryan.
 
EDIT: Doing this will still only include data where there is an Effective Date as per your first post. If the user selects "Expiration Date" as the sort method that won't affect that suppression - If you want it to we can modify that suppression formula to take the parameter value into consideration.


Edited by rkrowland - 19 Jan 2012 at 5:35am
IP IP Logged
Kerkuk
Newbie
Newbie


Joined: 08 Dec 2011
Online Status: Offline
Posts: 22
Quote Kerkuk Replybullet Posted: 20 Jan 2012 at 7:53am
Thanks again , you are big help can you tell me what is the formula that take  parameter value into consideration?
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 22 Jan 2012 at 9:47pm

if {?Sorting Method} = "Effective Date"

then {command.effectiveDate}

else {table.otherfieldoption}
 
The {?Sorting Method} is the parameter field.
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