Creating a calculated field that uses if/then logic | Community
Skip to main content
Level 4
October 25, 2023
Solved

Creating a calculated field that uses if/then logic

  • October 25, 2023
  • 1 reply
  • 2995 views

Hi All,

I'm attempting to create a calculated field that is based on an asset field with 97 different selections. The way I'm envisioning it is if a particular group of assets are selected from the previous custom field, the calculated field with display text such as "Graphic". There's going to be about 17 different options/text that I want to display.  Is this possible to pull off using a calculated field?

Best answer by skyehansen

Honestly, this is a grey area for me.  I wouldn't know where to start with creating a calculated field with multiple IFIN formulas in it.  what formula would I need to start with in order to get that going?


hi Seth, you would start with the original formula in the link I posted above, and just continue to add to it. The original formula is this:

 

IFIN(value, value1, value2,..., trueExpression, falseExpression)

 

 

Let's refer to the above as one complete IFIN statement.

If you had two options, you would want to sub out the falseExpression for another complete IFIN statement, e.g.:

 

IFIN(value, value1, value2,..., trueExpressionA, IFIN(value3, value4, value5,..., trueExpressionB, falseExpression))

 

 

If you had 3 options, you would swap out the falseExpression yet again, like this:

 

IFIN(value, value1, value2,..., trueExpressionA, IFIN(value3, value4, value5,..., trueExpressionB, IFIN(value6, value7, value8,..., trueExpressionC, falseExpression)))

 

 

You mentioned you had 17 options, so you would just do this another 13 or 14 times (I would test each time in order to make sure that each option was coming in, before adding a new option).

 

Doug dH does give a real world example here as well (with 2 options): 

https://experienceleaguecommunities.adobe.com/t5/workfront-ideas/add-switch-function-to-calculated-field/idi-p/581636

1 reply

RandyRoberts
Community Advisor
Community Advisor
October 25, 2023

Short answer: maybe.

Can you post an example of what it might look like (in plain English)? When you say "if a particular group of assets are selected from the previous custom field", what will define that "group"?

You can always say IF({field name} equals "this value", then,display "This", if not then display "That") but I think you're asking for more than a simple if/else statement.

Level 4
October 25, 2023

sure, when I say group, I mean of the potential 97 asset options from the previous field, maybe 6 of them when selected will have the same answer in the calculated field such as "Graphic".  So, in theory this calculated field will be grouping them together.

skyehansen
Community Advisor
skyehansenCommunity AdvisorAccepted solution
October 28, 2023

Honestly, this is a grey area for me.  I wouldn't know where to start with creating a calculated field with multiple IFIN formulas in it.  what formula would I need to start with in order to get that going?


hi Seth, you would start with the original formula in the link I posted above, and just continue to add to it. The original formula is this:

 

IFIN(value, value1, value2,..., trueExpression, falseExpression)

 

 

Let's refer to the above as one complete IFIN statement.

If you had two options, you would want to sub out the falseExpression for another complete IFIN statement, e.g.:

 

IFIN(value, value1, value2,..., trueExpressionA, IFIN(value3, value4, value5,..., trueExpressionB, falseExpression))

 

 

If you had 3 options, you would swap out the falseExpression yet again, like this:

 

IFIN(value, value1, value2,..., trueExpressionA, IFIN(value3, value4, value5,..., trueExpressionB, IFIN(value6, value7, value8,..., trueExpressionC, falseExpression)))

 

 

You mentioned you had 17 options, so you would just do this another 13 or 14 times (I would test each time in order to make sure that each option was coming in, before adding a new option).

 

Doug dH does give a real world example here as well (with 2 options): 

https://experienceleaguecommunities.adobe.com/t5/workfront-ideas/add-switch-function-to-calculated-field/idi-p/581636