Skip to main content
1-Visitor
January 13, 2025
Solved

Computed Field for bulk options with many probablity logical conditions

  • January 13, 2025
  • 1 reply
  • 670 views

I am working on deriving the default output for a choice field in our project, based on other two choice lists and on conditions that depend on fields with 4 and 5 choices. I have implemented the probable conditions as shown below, but currently I am only able to get the result for a single condition. Could you please help me obtain the output values for all the possible conditions or suggest the correct expression to handle these cases.

These three lists are used together to assess the overall risk.

 Impact Rating (choiceList[2])

ID 1: Severe

ID 2: High

ID 3: Medium

ID 4: Negligible

Feasibility Rating (choiceList[3])

ID 1: Very Low

ID 2: Low

ID 3: Medium

ID 4: High

Risk Level (choiceList[4])

ID 1: L1 

ID 2: L2

ID 3: L3 

ID 4: L4 

ID 5: L5 

This is the expression i am trying in computed as box in risk level choice list 

List(choiceList[4]_$option[
    (choiceList[2][0].id == 1 && choiceList[3][0].id == 4) ? 5 :
    ((choiceList[2][0].id == 1 && choiceList[3][0].id == 3) || 
     (choiceList[2][0].id == 2 && choiceList[3][0].id == 4)) ? 4 :
    ((choiceList[2][0].id == 1 && choiceList[3][0].id == 2) || 
     (choiceList[2][0].id == 2 && choiceList[3][0].id == 3) ||
     (choiceList[2][0].id == 3 && choiceList[3][0].id == 4)) ? 3 :
    ((choiceList[2][0].id == 1 && choiceList[3][0].id == 1) || 
     (choiceList[2][0].id == 2 && choiceList[3][0].id == 2) ||
     (choiceList[2][0].id == 3 && (choiceList[3][0].id == 2 || choiceList[3][0].id == 3))) ? 2 :1])

 

 

Best answer by Istvan_Molnar

Hello,

 

please try the following computed formula:

 

List(
 choiceList[4]_$option[
 List(
 List(0,0,0,0,0),
 List(0,2,3,4,5),
 List(0,1,2,3,4),
 List(0,1,2,2,3),
 List(0,1,1,1,1))
 [choiceList[2][0].id]
 [choiceList[3][0].id]
 ]
)

 

Regards,
Istvan

1 reply

12-Amethyst
January 14, 2025

Hello,

 

please try the following computed formula:

 

List(
 choiceList[4]_$option[
 List(
 List(0,0,0,0,0),
 List(0,2,3,4,5),
 List(0,1,2,3,4),
 List(0,1,2,2,3),
 List(0,1,1,1,1))
 [choiceList[2][0].id]
 [choiceList[3][0].id]
 ]
)

 

Regards,
Istvan

1-Visitor
January 15, 2025

Hello,

 

I have tried the computed formula you provided and it worked.

 

Thank you for your reply.