Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Build Group Increments Post Reply Post New Topic
Author Message
vcs1161
Newbie
Newbie


Joined: 03 Mar 2010
Online Status: Offline
Posts: 33
Quote vcs1161 Replybullet Topic: Build Group Increments
    Posted: 29 Oct 2014 at 5:08am
I have the results from a datediff formula in minutes in my report.  I would like to group these numbers in increments of 30.  So those records where the datediff is 0-30 minutes would be grouped as "0-30", datediff of 31-60 would be "31-60" and so on.  Any ideas of how I can build these in Crystal? 
 
Thank you for your time.
IP IP Logged
vcs1161
Newbie
Newbie


Joined: 03 Mar 2010
Online Status: Offline
Posts: 33
Quote vcs1161 Replybullet Posted: 29 Oct 2014 at 5:30am
I think I just figured it out:
 
if INT({Command.timediff}/30) + 1 = 1
then "0-"+totext((INT({Command.timediff}/30) + 1)*30)
else
totext (((INT({Command.timediff}/30) + 1)*30)-29)+"-"+totext((INT({Command.timediff}/30) + 1)*30)
 
Clap


Edited by vcs1161 - 29 Oct 2014 at 5:34am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Oct 2014 at 5:30am
totext(ceiling(datediffvalue,30)-30,0,'')+'-'+Totext(Ceiling(datediffvalue,30),0,'')
IP IP Logged
vcs1161
Newbie
Newbie


Joined: 03 Mar 2010
Online Status: Offline
Posts: 33
Quote vcs1161 Replybullet Posted: 29 Oct 2014 at 5:47am
Thank you.  This works also but it does not begin the next group by one so this seems to work after the first group is created.
 
if {Command.timediff} in [0 to 30] then "0-"+Totext(Ceiling({Command.timediff},30),0,'')
else
totext(ceiling({Command.timediff},30)-29,0,'')+'-'+Totext(Ceiling({Command.timediff},30),0,'')
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Oct 2014 at 5:53am
note I also noticed it breaks if the value is 0 so you may want another IF to start it with
IP IP Logged
vcs1161
Newbie
Newbie


Joined: 03 Mar 2010
Online Status: Offline
Posts: 33
Quote vcs1161 Replybullet Posted: 29 Oct 2014 at 7:32am
Yep, I do see that.  Thank you very much. 
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.