Visibility condition in plugin parameter
I have a Python plugin with a parameter A of type "MULTISELECT" and another parameter B which I'd like to hide based on A.
For instance, if A can take on the values (1, 2, 3), what should be the "visibilityCondition" for parameter B when A meets one of these conditions?
- Hide B if A has no values selected
- Hide B if A = [1]
- Don't hide B if A has 1 but also other values
I tried "[2,3].some( el => model.A.includes(el))" but it doesn't work
Answers
-
I know this was asked a while ago, but hopefully this will help someone else that stumbles upon this thread!
In one of my plugins, I have some logical operators that depend on two different parameters. You could combine the logical operators with the syntax for multi select params:
multi select syntax = "model.my_param.includes('my_choice')"
my logical example = "(model.add_date_to_file == true)||((model.add_date_to_subject == true)&&(model.send_email == true))"
In your example, I imagine you have some limited amount of options for your multi select? I'll use 1, 2, 3 for simplicity.
Wouldn't it suffice to say "Show B only if A contains 2 or 3" : "visibilitycondition" : "model.A.includes('2')||model.A.includes('3')"
This would hide B if A is empty (because it does not contain 2 or 3) or if A only contains 1.