cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Accept widget value during runtime from user

LJ
New Contributor II

list1 = ('alpha', 'beta', 'gamma', 'eta', 'Theta')

list2 = ('alpha', 'beta')

df1 = spark.createDataFrame(list1, 'String').withColumnRenamed('value', 'dataset')

df2 = spark.createDataFrame(list2, 'String').withColumnRenamed('value', 'dataset')

df = df1.exceptAll(df2)

list_of_values = [data[0] for data in df.collect()]

dbutils.widgets.dropdown("dataset", list_of_values[0], list_of_values)

dataset = dbutils.widgets.get("dataset")

print(dataset)

In above code is there a way to get data from user after widget creation?

1 ACCEPTED SOLUTION

Accepted Solutions

Hubert-Dudek
Esteemed Contributor III

Every time the user change selection in the widget, you get that selectionโ€”behavior after the dropdown change you can define in widget settings.

image.png

View solution in original post

1 REPLY 1

Hubert-Dudek
Esteemed Contributor III

Every time the user change selection in the widget, you get that selectionโ€”behavior after the dropdown change you can define in widget settings.

image.png

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now