Expand my Community achievements bar.

SOLVED

I'm trying to use a calculated field to add an automatic warning on a request form if a delivery date less than 10 working days away is entered in a date field.

Avatar

Level 1

I’ve been trying to crack this for ages, but I feel like I’m getting more confused and further away from a solution the longer I go. I always get a ‚ÄòCustom Expression Invalid’ error when trying to use WEEKDAYDIFF.

I expect it to be something like the below:

=IF((WEEKDAYDIFF({DE:POSDELDATE}, Today) <= 7),”Please allow 7 days for delivery”

I’m super new to the platform and have very little relevant coding experience. If anyone fancies taking pity on a newbie and pointing me in the right direction I’d be incredibly grateful. When I get my head around this thing I’ll be sure to pay the kindness forward. Thanks!

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi Luke,

Firstly welcome to Workfront! The community is a great place to ask questions like this, there are plenty of people here happy to help!

The below code should work for you:

IF(WEEKDAYDIFF({DE:POSDELDATE},$$TODAY)<=7,'Please allow 7 days for delivery')

A couple of pointers for you:

  • Your syntax was a little off. You only needed the one opening bracket and you missed a closing bracket at the end of your statement
  • When using a wildcard variable such as 'today' or 'now', you need to add two dollar signs beforehand. So today would be $$TODAY. There's some more info on wildcards here
  • The WEEKDAYDIFF function works out the number of weekdays between two dates, but it doesn't work out working days. So if you have public holidays in the date range when your team aren't working, these wont be taken into account in the calculation. A way to avoid this is to use the WORKMINUTESDIFF function which takes into account the working hours of your staff. If you thnk this could be a problem, you could update the calculation to the following which would take into account exceptions in your work schedule like bank holidays:

IF(WORKMINUTESDIFF({DE:POSDELDATE},$$TODAY)<=4800,'Please allow 7 days for delivery')

The above calculation assumes that you have 8 hours (480 mins) in a working day, resulting in 4800 minutes for 10 working days.

Hope this helps! Please shout if you have anymore questions.

Best Regards,

Rich.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi Luke,

Firstly welcome to Workfront! The community is a great place to ask questions like this, there are plenty of people here happy to help!

The below code should work for you:

IF(WEEKDAYDIFF({DE:POSDELDATE},$$TODAY)<=7,'Please allow 7 days for delivery')

A couple of pointers for you:

  • Your syntax was a little off. You only needed the one opening bracket and you missed a closing bracket at the end of your statement
  • When using a wildcard variable such as 'today' or 'now', you need to add two dollar signs beforehand. So today would be $$TODAY. There's some more info on wildcards here
  • The WEEKDAYDIFF function works out the number of weekdays between two dates, but it doesn't work out working days. So if you have public holidays in the date range when your team aren't working, these wont be taken into account in the calculation. A way to avoid this is to use the WORKMINUTESDIFF function which takes into account the working hours of your staff. If you thnk this could be a problem, you could update the calculation to the following which would take into account exceptions in your work schedule like bank holidays:

IF(WORKMINUTESDIFF({DE:POSDELDATE},$$TODAY)<=4800,'Please allow 7 days for delivery')

The above calculation assumes that you have 8 hours (480 mins) in a working day, resulting in 4800 minutes for 10 working days.

Hope this helps! Please shout if you have anymore questions.

Best Regards,

Rich.

Avatar

Level 1

This is brilliant. Thanks so much for your help Richard!