pass variable in drop down from another notebook

Abhishek Gaikwad 191 Reputation points
2021-04-20T06:28:10.157+00:00

Hi,

I am trying to pass a variable from notebook A to Notebook B which has drop down widget list.
However getting below error.

error message : select sequence must include X

Notebook A has below variable defined.
parameters_global['Source'] = '["X","Y","Z"]'

Notebook B has below code :

$run ./Parameter/notebook_A

dbutils.widgets.dropdown("Source","X",parameters_global['Source'],"Select Source")

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,162 questions
0 comments No comments
{count} votes

Accepted answer
  1. PRADEEPCHEEKATLA-MSFT 88,716 Reputation points Microsoft Employee
    2021-04-20T10:02:30.637+00:00

    Hello @Abhishek Gaikwad ,

    If you run a notebook that contains widgets, the specified notebook is run with the widget’s default values. You can also pass in values to widgets.

    For example: %run /path/to/notebook $X="10" $Y="1"

    Note: This example runs the specified notebook and passes 10 into widget X and 1 into widget Y.

    For more details, refer How to use widgets with %run.

    Hope this helps. Do let us know if you any further queries.

    ------------

    Please don’t forget to Accept Answer and Up-Vote wherever the information provided helps you, this can be beneficial to other community members.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.