Expand my Community achievements bar.

Don't miss the Workfront Community Lens, June Edition!
SOLVED

IF Expression on a Drop-Down and Date Field

Avatar

Level 3

I am trying to create a calculated field in an Issue Custom Form to auto-populate a date for users.

I am able to code the date using the 'ADDWEEKDAYS()' expression based on a custom date field used earlier in the form but I would like to add a certain complexity based on an another selection made  in a drop-down custom field with three options 'BAU, Existing or New'.

Each of the three drop-down options would result in the generation of a different date based on the date field earlier in the form. 

Does anyone know how I could use the 'IF' expression to code the three different possibilities and for the field to have the capacity to generate three different dates when taking the date field and the drop-down in conjunction?

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hello @ThomasNe2, I'll make few assumptions here as the instructions are not clear.

Let’s assume:

  • DE:Date is the custom date field.
  • DE:IssueType is the drop-down field with values: 'BAU', 'Existing', and 'New'.

And the expected output is:

  • If IssueType = 'BAU', add 2 weekdays.
  • If IssueType = 'Existing', add 5 weekdays.
  • If IssueType = 'New', add 10 weekdays.

Then,

IF({DE:IssueType} = "BAU", ADDWEEKDAYS({DE:Date}, 2),
   IF({DE:IssueType} = "Existing", ADDWEEKDAYS({DE:Date}, 5),
      IF({DE:IssueType} = "New", ADDWEEKDAYS({DE:Date}, 10), "")))

 

View solution in original post

4 Replies

Avatar

Correct answer by
Level 9

Hello @ThomasNe2, I'll make few assumptions here as the instructions are not clear.

Let’s assume:

  • DE:Date is the custom date field.
  • DE:IssueType is the drop-down field with values: 'BAU', 'Existing', and 'New'.

And the expected output is:

  • If IssueType = 'BAU', add 2 weekdays.
  • If IssueType = 'Existing', add 5 weekdays.
  • If IssueType = 'New', add 10 weekdays.

Then,

IF({DE:IssueType} = "BAU", ADDWEEKDAYS({DE:Date}, 2),
   IF({DE:IssueType} = "Existing", ADDWEEKDAYS({DE:Date}, 5),
      IF({DE:IssueType} = "New", ADDWEEKDAYS({DE:Date}, 10), "")))

 

Avatar

Level 3

Hi Manish 

Thanks so much for this! I added the first expression related to BAU and it worked perfectly. I have then added the expression for Existing, separated by a comma but I am getting an error. Should I be separating them a different way? 

Avatar

Level 9

After '-14', you just need one closing bracket. Similarly, after -18 just one closing bracket.

Avatar

Level 9

In simple language, this would translate to if(BAU, then adddays(-14), elseif(Existing, then adddays(-18), elseif.....