Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Calculating backwards from desired end date


boywonder
 Share

Recommended Posts

I need to calculate backwards from a desired end date across multiple tasks, while allowing a certain amount of overlap between tasks to occur. This is working fine, but occassionally I will have a start date that's a weekend date and I'm having trouble eliminating these across mulitple conditions. Any thoughts?

 

Desired End Date = Date Field

duration = number

 

Set Field [TaskAStart; (Desired_end_date-(taskA::duration/5)*7

Set Field [TaskBStart;(taskAstart::job_start_date-(taskB::duration/5)*7/2.5

Set Field [TaskCStart;

(If(IsEmpty(taskB::job_start_date),

taskA::job_start_date-(taskC::duration/5)*7/2.5,

taskB::job_start_date-(taskC::duration/5)*7/2.5)

 

and so on ...

 

I've tried testing for Daynames and making modifications as I calc start

dates backwards from desired end:

 

If(DayName(DesiredEndDate-(TaskA::duration)="sunday");

DesiredEndDate-(TaskA::duration+1);

 

If(DayName(DesiredEndDate-(TaskA::duration)="saturday");

DesiredEndDate-(TaskA::duration+2);

 

DesiredEndDate-(TaskA::bid_days)))

 

but never get 100% no weekend starts ...

 

any thoughts??

 

thanks in advance

Link to comment
Share on other sites

If(DayName(DesiredEndDate-(TaskA::duration)="sunday");

DesiredEndDate-(TaskA::duration+1);

 

The brain cells in my brain responsible for math don't always work well, but shoudln't that be:

 

If(DayName(DesiredEndDate - (TaskA::duration) = "sunday"),

DesiredEndDate-(TaskA::duration) + 1

 

?

 

I'd think subtracting one more day if the day you land on is "sunday" would mean you land on "saturday", and that's what you're doing if you add the 1 day to what you're subtracting.

 

Whereas:

 

 

If(DayName(DesiredEndDate-(TaskA::duration)="saturday");

DesiredEndDate-(TaskA::duration+2);

 

 

is, I think, harmless, but it's going to give you Thursday. I'm guessing you intended Monday?

 

I could be insufficiently caffeinated, so check this for yourself.

Link to comment
Share on other sites

If you go backwards from Saturday 1 day and backwards from Sunday 2 days you still don't get a weekday with any consistency. I've tried going forwards to the next working day in case there was some kind of problem directionally, but the effect is the same.

 

If(DesiredEndDate-(TaskDuration)="sunday");

DesiredEndDate-(TaskDuration)-2;

 

If(DesiredEndDate-(TaskDuration)="saturday");

DesiredEndDate-(BidTasksCompLink::bid_days)-1;

 

DesiredEndDate-(TaskDuration)))

 

I've used this in the past, which is simpler but still has the same random problem:

 

DesiredEndDate-(TaskDuration/5)*7

 

open to any ideas

 

thanks

Link to comment
Share on other sites

DesiredEndDate - TaskDuration isn't ever, ever, going to be "Sunday".

 

DayName( DesiredEndDate - TaskDuration ) will occasionally be "Sunday".

 

You had that function in your previous post, did you just accidentally omit it when typing this time?

Link to comment
Share on other sites

Don't understand your question ? But the Desired end date will always be a weekday, and all of the supporting task starts will also be weekdays ...

Link to comment
Share on other sites

:confused:

 

In your post — post#3 in this thread — you neglected to surround DesiredEndDate - TaskDuration with the DayName function.

 

DesiredEndDate - TaskDuration is going to give you 10/15/2006, perhaps, but it is never going to give you "Sunday".

 

DayName(DesiredEndDate - TaskDuration) will give you "Sunday" where DesiredEndDate - TaskDuration) = 10/15/2006 and 10/15/2006 is, in fact, a Sunday.

Link to comment
Share on other sites

After all of the start dates are calculated, I've added a loop that combs through all of the related records and corrects the weekend days by going to the friday prior.

 

so all good now

 

thanks

 

Go to Record/Request/Page [First]

Loop

Link to comment
Share on other sites

sorry didn't complete

 

Go to Record/Request/Patge [First]

Loop

If [Dayname(TaskA::job_start)="saturday"

Insert Calculated Result [select,TaskA::job_start;TaskA::job_start-1]

Else If

If [Dayname(TaskA:job_start)="sunday"

Insert Calculated Result [select,TaskA::job_start;TaskA::job_start-2]

Go to Record/Request/Patge [Next;Exit After Last]

End Loop

 

coolio

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

Terms of Use