Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date Report Selection Formula Post Reply Post New Topic
Author Message
lstieg
Newbie
Newbie


Joined: 08 Aug 2011
Online Status: Offline
Posts: 4
Quote lstieg Replybullet Topic: Date Report Selection Formula
     Posted: 09 Aug 2011 at 3:10am
For ease of scheduling I am trying to create a formula which will allow the following...
 
if status is 1 then record set should be is null completion date
if today is >= 15 then want to see completion dates of 1st - 15th of current month
otherwise I want to see the 16th - EOM for PREVIOUS month.... pretty sure I have most of it but the EOM part....
 
Here is my formula.....
 
{eligibility.hospital_campus} = {?Hospital Name} and
(if {?Status}= "1" then IsNull ({eligibility.completion_date})
else if Day (currentdate) >= 15
then {eligibility.completion_date} >= currentdate-16 and {eligibility.completion_date} < currentdate-1
else {eligibility.completion_date} > DATEADD("dd",15,DATEADD("mm",DATEDIFF("mm",0,CURRENTDATE()),0)) 
 ELSE DATEADD("mm",DATEDIFF("mm",0,GETDATE())+1,-1)+1)
 
Thanks in advance for looking.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Aug 2011 at 4:23am
{eligibility.hospital_campus} = {?Hospital Name} and
(
(IsNull ({eligibility.completion_date} and {?Status}= "1" )
or
(Day (currentdate) >= 15 and {eligibility.completion_date} in dateserial(year(currentdate),month(currentdate),1) to dateserial(year(currentdate),month(currentdate),15))
or
(Day (currentdate) < 15 and {eligibility.completion_date} in dateserial(year(currentdate),month(currentdate)-1,15) to dateserial(year(currentdate),month(currentdate),1-1))
)


Edited by DBlank - 09 Aug 2011 at 4:24am
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