×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# x number of weeks in future

## x number of weeks in future

(OP)
I have the following formula that computes data that is 7 weeks in the future:
if {JOB_START_DATE}-42 in WeekToDateFromSun
then {QTY_TO_MAKE}-{QTY_MANUFACTURED}
What I am trying to do is create a formula that will collect all data beyond 7 weeks. The number of weeks have to be from Sunday not current date.

Is there a way to compute the date of the first day of the week (sunday) that a date falls in? ie. if the date falls on thursday that is 8 weeks in the future can I compute the first day of that week?
Any point in the right direction would be appreciated.
Rick

### RE: x number of weeks in future

To calculate the Sunday before any date you use the following:

{YourDateValue} - DayOfWeek({YourDateValue}) + 1

Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)

### RE: x number of weeks in future

(OP)
Thanks Ken. That's what I was after. I thought I could use the result of that to do what I wanted but I can't figure out how to do what I want.
Here's the formala that I came up with. It works fine but I was in hopes of finding a way to shorten it AND learn something along the way.
if not ({tblWIPMaster10.JOB_START_DATE}  in (WeekToDateFromSun) and
not ({tblWIPMaster10.JOB_START_DATE}-7  in (WeekToDateFromSun)) and
not ({tblWIPMaster10.JOB_START_DATE}-14  in (WeekToDateFromSun)) and
not ({tblWIPMaster10.JOB_START_DATE}-21  in (WeekToDateFromSun)) and
not ({tblWIPMaster10.JOB_START_DATE}-28  in (WeekToDateFromSun)) and
not ({tblWIPMaster10.JOB_START_DATE}-35  in (WeekToDateFromSun)) and
not ({tblWIPMaster10.JOB_START_DATE}-42  in (WeekToDateFromSun))    )
then ({tblWIPMaster10.QTY_TO_MAKE}-{tblWIPMaster10.QTY_MANUFACTURED})

Like I said it works but I can see it becoming cumbersome if several more weeks were involved. Can you give a clue as to how I can shorten this?
Rick

### RE: x number of weeks in future

Now I am a bit lost. Assuming today is April 4th, 2001 (A Wednesday), exactly what dates are you looking to include in the report?

Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)

### RE: x number of weeks in future

if {tblWIPMaster10.JOB_START_DATE}> ((currentdate - (Dayofweek(currentdate)+1))+ 42) then
{tblWIPMaster10.QTY_TO_MAKE}-{tblWIPMaster10.QTY_MANUFACTURED}

even better would be to create a parameter for the number of weeks out and then have the following:

if {tblWIPMaster10.JOB_START_DATE}> ((currentdate - (Dayofweek(currentdate)+1))+ (7*{?weeksout})) then
{tblWIPMaster10.QTY_TO_MAKE}-{tblWIPMaster10.QTY_MANUFACTURED}

Hope this helps

David C. Monks
david.monks@chase-international.com
http://www.chase-international.com
Accredited Crystal Decisions Enterprise Partner

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!