Dynamic Parameter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2025 05:40 AM
I have a query I need to run with two parameters: Workflow and workflow steps. The dropdown list supplied by "Steps" should change based on the input of the "Workflow" dropdown.
When I use the following code, it creates the "Steps" dropdown list based on the "Workflow" value that is selected in the parameter at that time. And then the list will not change from there. Is it possible to configure the "Steps" parameter to consistently change the dropdown values as selections for "Workflow" change?
current code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2025 02:35 AM
Databricks widgets don’t support dependent dropdowns automatically. So, when you create a Steps dropdown based on the Workflow selection, it won’t update on its own, you’ll need to manually re-run the cell that builds the Steps widget after selecting a different workflow.
You can set it up by by first creating the Workflow dropdown:
workflows = [row[0] for row in spark.sql("SELECT DISTINCT workflow_name FROM reference.workflowsteps").collect()] dbutils.widgets.dropdown("Workflow", workflows[0], workflows, "Workflow")
And then create the Steps dropdown (re-run this after selecting a Workflow)
selected_workflow = dbutils.widgets.get("Workflow") steps = [row[0] for row in spark.sql(f"SELECT stepname FROM reference.workflowsteps WHERE workflowname = '{selected_workflow}'").collect()] dbutils.widgets.dropdown("Steps", steps[0], steps, "Steps")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2025 11:12 AM
That's a shame it has to be re-instantiated each time! Thank you for letting me know that functionality is not currently supported.