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 839
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