Forum Discussion
Take out the parenthesis that have numbers inside them. Make it like this:
"[Date Created]+Days([Priority])". Sans quotes.
this ^^^ is the only line of code you need.
- MichelleCoslet8 years agoQrew Assistant Captain
how does it know to add the certain amount of days then, don't I need to specify how many days I need added to the date created?
if it is a priority 5 project that I started today, I need the due date to show 10/30/2017. that reminds me, I am basing this off of a standard m-f work week (not to include sat & sun)
- ChrisChris8 years agoQrew Assistant Captain
Is not [Priority] a formula field you created that has contains some 'x' number of days?
If so, then that is the parameter you pass to the Days() function. That makes it more dynamic and no need to have redundant lines of code.
- ChrisChris8 years agoQrew Assistant Captain
if(
dayofweek([Date Created]+Days([Priority]))=6,
[Date Created]+Days([Priority])+2,
dayofweek([Date Created]+Days([Priority]))=0,
[Date Created]+Days([Priority])+1,
[Date Created]+Days([Priority])
)
So this code adjusts the Due Date to Monday if the Priority date lands on a Saturday or a Sunday. 0=sunday, 6=Saturday. The default value will be Date Created plus priority days.
- MichelleCoslet8 years agoQrew Assistant Captain
No, sorry for the confusion.
[Due Date] field is a formula date field
[Priority] field is a numeric fieldI decide what the priority is based on the customers needs. I need the Due Date to automatically populate based on the Priority and the created date.
Priority 1 projects need to be completed by NEXT DAY (created date + 1 day)
Priority 10 projects need to be completed 10 days past the created date at the latest
- MichelleCoslet8 years agoQrew Assistant Captain
no - the number I set priority to is not meant to be the number of days added. The number of days added needs to come from the formula.
If I set the project to PRIORITY 1 (meaning highest priority), I need the DUE DATE to display 10/25/2017 (assuming I created the project today)
So the formula should *add 1 day* to the [date created] IF the priority is set to 1
*add 2 days* to the [date created] IF the priority is set to 2
*add 3 days* to the [date created] IF the priority is set to 3
- MCFNeil8 years agoQrew CaptainUse for formula "WeekDayAdd"
WeekDayAdd(ToDate([Date Created]), [Priority])
Thats it.
WeekdayAdd (Date d, Number n)
Description: Returns the date that is n weekdays past the given date d. n may be negative to move backward in time.
Example: WeekdayAdd([Start], [Duration]) returns the date that results if you add the value in the Duration field to the date in the Start field and count only weekdays.
WeekdayAdd(ToDate("6/20/2003"), 2) returns 6/24/2003
WeekdayAdd(ToDate("6/24/2003"), -2) returns 6/20/2003
If you have a date field named "Start Date" and that field has a value of 6/23/2003, then WeekdayAdd([Start Date], -2) returns 6/20/2003 - ChrisChris8 years agoQrew Assistant CaptainNo confusion intended. I get it.
- MichelleCoslet8 years agoQrew Assistant Captain
how isn't it an IF statement though? The priority the project is set at affects how many days to add to the [date created]
I would have assumed the formula would look more like this (Except written correctly since I am still getting syntax errors)
if(
[Priority]1, [Date Created]+Days(1),
[Priority]2, [Date Created]+Days(2),
[Priority]3, [Date Created]+Days(3),
[Priority]4, [Date Created]+Days(4),
[Priority]5, [Date Created]+Days(4),
[Priority]6, [Date Created]+Days(5),
[Priority]7, [Date Created]+Days(6),
[Priority]8, [Date Created]+Days(7),
[Priority]9, [Date Created]+Days(8),
[Priority]10, [Date Created]+Days(10))this should "change" the [due date] field in which I am writing this formula for, to the created date + x amount of days. x amount of days depends on the priority
priority 1 = +1 day
priority 2 = +2 days
etc
Maybe i'll just tackle this another day.
- ChrisChris8 years agoQrew Assistant Captain
Take it away, Matthew of cirrusops.