Calculate a different initial value based on enum selection

Is there a way to calculate the initial value of a date column, based on which option the user chooses from an ENUM in the same table?

Column timeline: allows the user to choose
3 Months
1 Year
3 Years
5 Years

If they choose 3 months, I want the By When Column to default to the initial value of TODAY()+90
If they choose 1 Year, I want the By When Column to default to the initial value of TODAY()+365
etc.

I’m just thinking that I could do this using an action once the record is added. But is there anyway to do this with one action or will I need to run 4 separate actions, each one checking for a different value?

Solved Solved
0 4 847
1 ACCEPTED SOLUTION

Please try following expression in the initial value of “By when”

IFS([Timeline]=“3 months”, TODAY()+90, [Timeline]=“1 Year”, TODAY()+365, [Timeline]=“3 Years”, TODAY()+1095,[Timeline]=“5 Years”, TODAY()+ 1825)

View solution in original post

4 REPLIES 4

I believe , yes, it could be done in both the ways you have mentioned.

  1. Setting the initial value of the “By When” column based on selection of the enum column “Timeline”

  2. Or creating an action type “set the values of some columns in this row” to set " By When" after the record is saved with any one of 4 timeline column enum options. If enum button is omitted , then I believe, yes, 4 different actions will be required.

Another third way could be to use the event action on form save to set the value of “By When” action based on timeline enum column value selection. This thrird way and 1st way will avoid any additional manual intervention by the user as required in option 2 above.

Thanks Suvrutt,

Here’s what I’ve tried so far:

I created a ENUM Timeline column in the Mission table with 4 values. (3 months, 1 year, 3 years and 5 years)
I created 4 separate workflows each looking for a different value in the Timeline when a new mission is added. And each triggers a separate action of “Set the value of some columns in a row” to change the By When date to some variation of TODAY()+xxxx number of days.

This hasn’t worked.

I’d like to try option 1. Do you have an idea of how I would write the expression? It seems like an if then statement but I don’t know how to express that with four variables.

Please try following expression in the initial value of “By when”

IFS([Timeline]=“3 months”, TODAY()+90, [Timeline]=“1 Year”, TODAY()+365, [Timeline]=“3 Years”, TODAY()+1095,[Timeline]=“5 Years”, TODAY()+ 1825)

Thanks Suvrutt,

Totally forgot about IFS. Yes that worked perfectly.

Top Labels in this Space