You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dynamic select is an helper function within [scripts](../../script_editor/index.mdx)that allows you to create a select field with dynamic options.
238
+
Dynamic select is a helper function that allows you to create a select field with dynamic options that recompute based on other input values. It's available in both [scripts](../../script_editor/index.mdx)and [flows](../../flows/1_flow_editor.mdx), but with different implementation requirements.
239
239
240
-
You must export the string type as `DynSelect_<name>` and the function as `<name>` :
240
+
### Dynamic select in scripts
241
+
242
+
For scripts, you must export both the string type as `DynSelect_<name>` and the function as `<name>`:
The select options recompute dynamically based on the other arguments, in this case `x` and `y`. You can also use `text` as an arg in the function to have the current text select input be passed.
295
+
### Dynamic select in flows
296
+
297
+
In flows, dynamic select is only available for flow input steps. You must define one function for each flow input field that is of dynamic select type. The function name must exactly match the name of the flow input field. No export type is required.
# If you have another dynamic select input named "category"
349
+
defcategory(department: str):
350
+
if department =="engineering":
351
+
return [
352
+
{"value": "frontend", "label": "Frontend"},
353
+
{"value": "backend", "label": "Backend"}
354
+
]
355
+
return [
356
+
{"value": "general", "label": "General"}
357
+
]
358
+
```
359
+
360
+
</TabItem>
361
+
</Tabs>
362
+
363
+
### How dynamic select works
364
+
365
+
The select options recompute dynamically based on other input arguments.
366
+
367
+
You can implement custom filtering and sorting logic within your function. In the examples above in the foo function, when `x` equals "bar" or `text` equals "42", the options are filtered to show only one option.
0 commit comments