Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Sort formula with string and date fields Post Reply Post New Topic
Author Message
JHemauer
Newbie
Newbie


Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 2
Quote JHemauer Replybullet Topic: Sort formula with string and date fields
    Posted: 24 Nov 2009 at 7:18am
New to the forum and hoping someone can help me. I've built a report that I can Group by Employee Name, Employee Schedule or the Schedule Start Time.
 
My problem is that the formula editor won't allow both string and date fields, so I had to convert the date field to a text field (using ToText), but now the report doesn't sort by time (as it now doesn't recognize that 1:00pm should come after 12:59pm. My formula is below, can anyone offer help?  
 
if {?SortOrder} = "C"
then {Employee.Entity_Name}
 
else if {?SortOrder} = "A"
then {EmployeeSchedule.barName}
 
else if {?SortOrder} = "T"
then ToText ({EmployeeSchedule.fromDateTime})
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 24 Nov 2009 at 8:04am
Since this is only needed for sorting foece the  toext(date) into a useful sorting format including military time use...
 
if {?SortOrder} = "C"
then {Employee.Entity_Name}
 
else if {?SortOrder} = "A"
then {EmployeeSchedule.barName}
 
else if {?SortOrder} = "T"
then ToText ({EmployeeSchedule.fromDateTime},'yyyyMMddHHmmss')


Edited by DBlank - 24 Nov 2009 at 8:05am
IP IP Logged
JHemauer
Newbie
Newbie


Joined: 15 Jul 2009
Location: United States
Online Status: Offline
Posts: 2
Quote JHemauer Replybullet Posted: 24 Nov 2009 at 8:12am
DBlank, thank you, that worked perfectly! I'm self-taught and it's the little things that kill me.
 
Much apprciated.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.