Hello,
How can I dynamically create parameters based on previous user input?
For example, if parametera options are ‘single’ and ‘double’,
I would like to generate one new parameter if the user chooses single and two new parameters if the user chooses double.
I tried to use a call back function and then an if statement but it didn’t work.
Thanks for your help!
def get_parametera_options(params, **kwargs):
if params.parametera == 'Single':
return ['1']
if params.parametera == 'Double':
return ['2']
class Parametrization(ViktorParametrization):
parametera = OptionField('Type', options=['Single', 'Double'])
# if user chooses Single, I want to generate parameter b
# if user chooses Double, I want to generate parameter c and d
# but I don't need parameter d to show if it is single
# Calling get_parametera_options doesn't work