Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Range Formula to Include Specific Cut Off Time

Status
Not open for further replies.

jpstrzoch

Technical User
Mar 24, 2004
59
US
Using Visual Cut I am executing a Crystal XI report extracting from an SQL 2000 DB. Today I am using the following formula to capture specific date ranges of activity. Please note that the report is executed programmatically via Visual Cut on Monday through Friday.

if {@Day of the Week} = 2 //Monday
then ({Command.CREATEDATE} in PrintDate -3)
and Ctime({Command.CREATEDATE})<={@EnterCutoffTime}

else ({Command.CREATEDATE} in PrintDate -1)//Tuesday, Wednesday, Thursday, Friday
and Ctime({Command.CREATEDATE})<={@EnterCutoffTime}

I have the need to add additional criteria yet I am stuck.

On Monday I want to include activity from Friday after the “@EnterCutoffTime” formula and through but prior to the “@EnterCutoffTime” on PrintDate. Then on Tuesday – Friday, activity from the previous business day, and after “@EnterCutoffTime” formula, and through but prior to the “@EnterCutoffTime” on PrintDate.

If I would write this the way I think it should be written I would do the following;

if {@Day of the Week} = 2 //Monday
then ({Command.CREATEDATE} in PrintDate -3)
and Ctime({Command.CREATEDATE})>={@EnterCutoffTime}
to ({Command.CREATEDATE} in PrintDate)
and Ctime({Command.CREATEDATE})<={@EnterCutoffTime}


else ({Command.CREATEDATE} in PrintDate -1)//Tuesday, Wednesday, Thursday, Friday
and Ctime({Command.CREATEDATE})>={@EnterCutoffTime}
to ({Command.CREATEDATE} in PrintDate)
and Ctime({Command.CREATEDATE})<={@EnterCutoffTime}

Won't work, the error message is "a time is required here" and it highlights the first ({Command.CREATEDATE} in PrintDate) in the formula.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top