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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Jobs created yesterday (unless it's Sunday or Monday)

Status
Not open for further replies.

gsmithmme

Technical User
Jun 3, 2004
51
0
0
US
I am using Crystal 8.5 with a paradox database. We have a field that stores the date a record is created. So, I have created a report that select all records where the job was created yesterday.

{@BookDate} = (Today)-1

However the user came back and said they cannot run that report on Monday, because the office is closed and so no jobs are created on Sunday. So I need to change up my formula so that if today is Monday, it will not look at jobs created on Sunday(there are none), but on Friday. Any ideas for a formula??
 
gsmithmme,

I do not have the ability to test this solution for exact syntax, but the following should provide what you seek.

{@BookDate}
Code:
IF DayOfWeek(CurrentDate)=2 THEN
(
    CurrentDate-3
) ELSE
(
    CurrentDate-1
)
Notes:
-- DayOfWeek() returns a numeric value for the day of week. Unless explicitly defined, Sunday=1, Monday=2, etc.
-- I have placed "CurrentDate" in place of "Today" in your code. You can continue to use "Today" if that works, I just have not seen that syntax.

Hope this helps! Cheers!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top