Search code examples
pysparkapache-zeppelin

Zeppelin - Dynamic update of default value in dynamic forms


I was looking for a way to update dynamically the default value of a selectForm. My code is the following:

%spark2.pyspark
d_var = {}
d_var['one'] = ["0"]
d_var['two'] = ["1"]

keys = []
values = [('0', 'True'), ('1', 'False')]
for key in sorted(d_var.keys()):
keys.append((key, key))

key = z.select('Keys', keys, keys[0][0])
default_value = '0' if key == 'one' else '1'
print default_value
value = z.select('Option', values, default_value)

When I change the selected value in the first select I expect that the second select will be updated but nothing happens, only in the first execution of the paragraph.

Thanks in advance.


Solution

  • It's a correct behaviour. Dynamic form stores value after initialization or after last change. User is expected that paragraph will run with value from dynamic forms. And there is no opportunity to distinguish when need to update or no need to update dynamic form.