Can we dynamically influence a SELECT dropdown based on previous SELECT's option in a plugin?

Solved!
nmadhu20
Can we dynamically influence a SELECT dropdown based on previous SELECT's option in a plugin?

Hi team, 

I need to create a plugin where based on user's input in one SELECT dropdown, the next SELECT dropdown's data will be shown. Basically, the second one will be dynamically populated based on first one's selection. 

I did come across this dataiku community question, however this only talks about multiple select parameters which are independent of each other.

I want to achieve this without having to create a separate custom UI altogether. Is there any solution?

This is how my do function looks like:

I tried using config['previous_parameter_name'] to get the previous details but it did not work(highlighted part)

 

image.png

 

 

 

 

 

 

 

Thanks, any leads are appreciated. 

1 Solution
Cรฉlian
Dataiker

Hi again,

You code and recipe.json are correct, the problem seem to be coming from DSS side. 

After investigation, I saw that there were some issues on dynamic selects in version 9.0.4 and older. If you update to 9.0.5 or later you will be able to do what you want.

View solution in original post

0 Kudos
3 Replies
Cรฉlian
Dataiker

Hi,

You can indeed use the value from config to populate a SELECT parameter based on another one's selection. The code you showed seemed to have a syntaxe issue, but the idea was correct. Here's an example of how you could do it, with 2 parameters A and B:

Capture dโ€™eฬcran 2021-11-03 aฬ€ 14.59.38.png

0 Kudos
nmadhu20
Author

Hi @Cรฉlian ,  thankyou for replying.

I tried executing  your code, however, the second drop-down still was not populating. I could see data in first drop-down but upon selection any option( A1/B1) nothing was shown in second one.

Could you help me in pointing out what might be wrong here?

This is how my recipe.json looks for the two parameters :

 

image.png

 

The drop-down : 

image.png

 

 

The code :

image.png

 

0 Kudos
Cรฉlian
Dataiker

Hi again,

You code and recipe.json are correct, the problem seem to be coming from DSS side. 

After investigation, I saw that there were some issues on dynamic selects in version 9.0.4 and older. If you update to 9.0.5 or later you will be able to do what you want.

0 Kudos