Expand my Community achievements bar.

SOLVED

AddHours not showing results

Avatar

Level 6

Hi all,

 

I'm new to Workfront, but not new to using formatting dates using expressions. I'm having an issue where I can add days to an existing date field, but when I want to AddHours to the same field then it outputs a blank field. Usually I would think there's either a code error or the input field isn't in the correct format, but I can't see either being the problem. Here's my example...

 

Request Date is the entrydate field in workfront. I want to add days to all of the request dates based on the priority field, but where the priority field is "Urgent" I need this to add 3 hours to the request date. Below shows that the "Target Completion Date" is resolving to blank for the urgent requests.

MattWindsor_0-1682591451591.png

 

Here are the properties of the Request Date output field...

MattWindsor_1-1682591609815.png

 

Here are the properties of the Target Comp Date output field...

MattWindsor_2-1682591678003.png

To make the logic clearer, I'll make it look pretty...

MattWindsor_3-1682591804172.png

Any help will be appreciated.

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi Doug,

 

I didn't get quite the result I was looking for as it returned a date 7.5 days in before the entryDate, but it did point me in the right direction. As you said, it can use decimals, so instead of using a whole number I just added a decimal to get the 3 hours added on e.g. ADDDAYS({entryDate},0.125). This now give me a lovely result, so thanks for your help on this one.

MattWindsor_0-1682608050607.png

Cheers

Matt

 

View solution in original post

5 Replies

Avatar

Community Advisor


Hi @MattWindsor,

 

Alas, there is no built in AddHours function, and as I recall, AddDays supports only integers (although you’re welcome to comfirm that for yourself).

 

Many, many years ago I did create a Service Level Agreement (SLA) solution using native Workfront, so I’ll dust off my notes to remind myself how I solved for “within X hours”.

 

Regards,

Doug

 

cc: @Doug_Den_Hoed__AtAppStore 

Hi @Doug_Den_Hoed__AtAppStore 

 

I've just noticed that the help page I was only was for Workfront Fusion, and not just Workfront. No wonder I was getting nowhere with it. If you do find something from your past, then that would be greatly appreciated.

 

Thanks

Matt

Avatar

Community Advisor

 

Ah: gotcha Matt,

 

After a pleasant stroll down SLA Memory Lane (which includes some inspirational screen shots you might enjoy), I'm delighted to inform you that I was mistaken: you can indeed use a decimal with the AddDays function, as per this example from my 

 

Custom Parameter (datetime): SLA Response Red

Description: Computes a 5 minute lead time until the SLA Response Required, which is used to switch the highlighting to Red on reports

Formula: ADDDAYS({DE:SLA Response Required},-(5/60)/24)

 

Give it a whirl (in your case, using (3/24), and let me know how it goes!

 

Regards,

Doug

 

TIP: if this solved your problem, I invite you to consider marking it as a Correct Answer to help others who might also find it of use

 

 

Avatar

Correct answer by
Level 6

Hi Doug,

 

I didn't get quite the result I was looking for as it returned a date 7.5 days in before the entryDate, but it did point me in the right direction. As you said, it can use decimals, so instead of using a whole number I just added a decimal to get the 3 hours added on e.g. ADDDAYS({entryDate},0.125). This now give me a lovely result, so thanks for your help on this one.

MattWindsor_0-1682608050607.png

Cheers

Matt

 

Avatar

Community Advisor

 

Excellent Matt,

 

Yes, in my previous post, the SLA Response Required date represents the calculated "in the future" date where where an item will be offside from an SLA perspective, which is why I was deducting five minutes from it. Since you're simply working with the entry date, though, you need to add 3 hours. I've amended my previous post accordingly to match (i.e. 3/60 = 0.125) accordingly, so it now should be the correct answer for anyone who needs to use the technique.

 

Regards

Doug