×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*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.

Students Click Here

Jobs

x number of weeks in future

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

Ken Hamady
http://www.kenhamady.com/
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?
Thanks in advance,
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?

Ken Hamady
http://www.kenhamady.com/
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)

RE: x number of weeks in future

RickBooker: How about:

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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close