Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Show 5pm on next Monday if condition met Post Reply Post New Topic
Author Message
rob.morris
Newbie
Newbie


Joined: 09 Oct 2014
Online Status: Offline
Posts: 3
Quote rob.morris Replybullet Topic: Show 5pm on next Monday if condition met
    Posted: 10 Oct 2014 at 5:21am
I'm trying to set up a report in Crystal that shows target times for deliveries.
Our contractor has the following rules:
If the job is logged Monday - Friday the target delivery is 24 hours
If the job is logged Saturday all day or Sunday before 12pm the target is 12pm on the next Monday.
If the job is logged after 12pm on Sunday the target is 24 hours.
 
I've created a long-winded way of sort of doing it by creating a
ToText formula for the day  and one for the time
And then saying
if @day = "saturday" and @time = "13" then
PPV.DATERECEIVED+47
and changing the time and date received values but this doesn't give me an exact 5pm period.
 
Surely there is a quicker way that can check the date and time a job was logged and produce a set time if the condition is met?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Oct 2014 at 6:28am
maybe this?
 
NextMondayNoon:= dateadd("h",12,DATEADD("ww", DATEDIFF("ww", date(1900,1,1), {PPV.DATERECEIVED})+1, date(1900,1,1)));
DueDate:= if datediff("h",{PPV.DATERECEIVED},NextMondayNoon) in 12 to 36 then NextMondayNoon else dateadd("d",1,{PPV.DATERECEIVED})
 
Note: this is using Noon on MOnday as that is what the body of the post requested vs. the 5pm in the post title.


Edited by DBlank - 10 Oct 2014 at 6:54am
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.