- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2021 12:34 PM
I have a notebook which has a parameter defined as
dbutils.widgets.multiselect("my_param", "ALL", ["ALL", "A", "B", "C")
and I would like to pass this parameter when calling the notebook via
dbutils.notebook.run()
However, I tried passing it as an python-array, JSON-array-string, etc. but nothing worked.
any one has any ideas?
- Labels:
-
Multiselect
-
Notebook
-
Notebooks
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2021 07:06 AM
I have not yet used a multiselect, but for a single value widget you get {"widget":"value"}
And according to the help:
When using dbutils.widgets.get() with a multiselect widget, you get a string of
comma delimited items that are selected by user.
So I would think you have to pass a comma separated string, so "ALL, A, B, C", a string object not an array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2021 07:06 AM
I have not yet used a multiselect, but for a single value widget you get {"widget":"value"}
And according to the help:
When using dbutils.widgets.get() with a multiselect widget, you get a string of
comma delimited items that are selected by user.
So I would think you have to pass a comma separated string, so "ALL, A, B, C", a string object not an array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2021 02:57 AM
you are right, this actually works fine.
I just realized I had two multiselect parameters in my tests and only changing one of them still resulted in the same error message for the second one 😕
I ended up writing a function that parses whatever comes in via the widget to an array/list which also supports JSON arrays now

