简体   繁体   中英

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.

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)))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM