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

nmadhu20
nmadhu20 Neuron, Registered, Neuron 2022, Neuron 2023 Posts: 35 Neuron

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.

Best Answer

  • Célian
    Célian Dataiker, Registered Posts: 4 Dataiker
    Answer ✓

    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.

Answers

  • Célian
    Célian Dataiker, Registered Posts: 4 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’écran 2021-11-03 à 14.59.38.png

  • nmadhu20
    nmadhu20 Neuron, Registered, Neuron 2022, Neuron 2023 Posts: 35 Neuron

    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

Setup Info
    Tags
      Help me…