Can we pass a dynamic list in SELECT Parameter based on the value entered by user in other parameter

mohitbatra007
mohitbatra007 Registered Posts: 1 ✭✭✭

Hi,

I am trying to pass a dynamic list in select parameter (parameter-b) based on the text entered by user in a string parameter (parameter-a). I am not sure how to do this.

I am able to pass a list in select parameter using the following code:

import os

def do(payload, config, plugin_config, inputs):
load_file_list0= [i for i in os.listdir("/location/") if ".out" in i]
choices=[]
for i in load_file_list0:
choices_dir={}
choices_dir["value"]=i
choices_dir["label"]=i
choices.append(choices_dir)
return {"choices": choices}

But I want to do something like this:


def do(payload, config, plugin_config, inputs):
a= get_recipe_config()["parameter-a"]
load_file_list0= [i for i in os.listdir("/location/") if ".out" in i]
choices=[]
for i in load_file_list0:
if a.lower() in i.lower():
choices_dir={}
choices_dir["value"]=i
choices_dir["label"]=i
choices.append(choices_dir)
return {"choices": choices}

Tagged:

Answers

Setup Info
    Tags
      Help me…