Passing workspace variable as items in Select input
hi!
I have a py script that returns results that is connected to a Select > Items. However, I can't seem to display the items stored in variable via dropdown. Is there a specific way to store the variable so it picks up by Select?
I have the items stored as a json like so.
[{"value":"aaa","label":"aaa"},
{"value":"bbb","label":"bbb"},
{"value":"ccc","label":"ccc"}]
7 Replies
You can do that with resources and the resource select
Thanks! I tried it out and I must be doing something wrong somewhere.
1. Created a resource type for an array.
2. Created a resource and pasted the json array inside.
3. Called resource in Resource Select but it doesn't show the json array as a list of items.
Hope you could give me some pointers here. TIA!
The resource select is to select one resource at a time of a specific resource type
Then in each resource you can link the variable inside
The other solution is to make a select and use as value the path to the variable
You can also use as value $var:path which when used as argument of a script, will be interpolated as the value of the variable
Sorry, it may be my lack of sleep here (building on windmill makes me forget to sleep...). As I understand, it means for each resource it will hold one variable?
My end goal is to have a place to hold a list of items (to centrally manage it), and to be able to call it in Select input-types which will render the list of items - if this makes sense to you?
So you could also do this in one resource if you prefer and use a select
For that you would need to retrieve that resource as input of your select
To do that, you could connect your select to a bg script that fetch the resource
The value of the resource should be an array like the one above
Alright, let me try just that when I'm not sleep-depreived.
Thanks for answering on a Sunday! Have a great day ahead!
Thanks, no worries. I have my phone on the 🏖️