Yi Du
Yi Du

Reputation: 525

Multiselect widget in Databricks notebook

I made multiselect widgets in the databricks notebook.

dbutils.widgets.multiselect("Scenario", "Actual", [str(x) for x in scenario_type])

But I wanted to use the selected value to update the table I have.

Once there is only one item selected, it works.

display(ur.filter((ur.scenario == getArgument("Scenario")))

However, if I select multiple items, it didn't obviously.

Do you know how to make multi-selection work in my scenario?

Thanks.

Upvotes: 1

Views: 8096

Answers (1)

Vivek Singh
Vivek Singh

Reputation: 88

You can make the list from selected values and use isin method to filter the records.

myList = getArgument("Scenario").split(",")
display(ur.filter(ur.scenario.isin(myList)))

Upvotes: 2

Related Questions