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

Formula for Determining the Date of Next Monday

Status
Not open for further replies.

enbw

Technical User
Mar 13, 2003
296
Hi,

I'm a new to crystal reports. I am writing a report to produce a work to list for departments. What ever date/day it is I need to determine the date of the next monday to use to select records. I actually need the date of the following friday as well... I believe that I need to use a formula field. Everytime the report is run it will automatically select the correct records for the forthcoming week. Thanks in advance.
 
Try posting technical information when requesting it, such as:

Crystal version
Database used
Example data
Expected output

I assume that what you're trying to ask for is a means to limit rows to next weeks business days: Monday through Friday whenever this report is run.

Are you concerned about eliminating Holidays?

Next Monday:
dateadd("d",7-dayofweek(currentdate)+2,currentdate)

Next Firday:
dateadd("d",(7-dayofweek(currentdate))+6,currentdate)

So to limit rows from a table which have a date within this range you might try:

Report->Edit Selection Formula->Record

{table.date} >= dateadd("d",(7-dayofweek(currentdate))+2,currentdate)
and
{table.date} <= dateadd("d",(7-dayofweek(currentdate))+6,currentdate)

If this isn't what you mean, please post technical information.

-k
 
Hi,

Thanks for the advice. I think what you have posted is along the lines I require. I am using Crystal 8.5 with a progress sql database. I am reporting on a table which contains operation due dates against a work centre and job number. E.g.
Job Number WC Due date
000032 FET 20/02/04

I want to be able to select the rows where the dates fall between the next monday and the following friday.

Thanks


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top