cascading Mutiple DropDown Dependancy

We have a use case where we need to display values in multiple drop down(say a) based on the previous multiple drop down (say b) values, there is no constrain as to which drop down should selected first. 

user can select any drop down and the other drop down should display value based on it. but when multiple values are selected, for each value the save into is executed and the drop down variables are refreshed and it is throwing an error.

It is either picking up only the first value and nullifying all the others , or it is nullfying the entire choice values. 

Interface Definition: Expression evaluation error at function a!multipleDropdownField [line 219]: A multiple dropdown component [label=“”] has an invalid value for “choiceValues”. Choice values cannot be null.

Please suggest as to what can be done to find out when all the values are saved into the variable in multiple dropdown

P.S we do not have buttons so all values should be calculated based on save into if dropdown alone

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    I modified your code as per my understanding of the requirement. Can you try the below code and let me know if it fits your requirement. 

     

    load(
      local!dropdownOneLabels: {
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10
      },
      local!dropdownTwoLabels: {
        "One",
        "Two",
        "Three",
        "Four",
        "Five",
        "Six",
        "Seven",
        "Eight",
        "Nine",
        "Ten"
      },
      local!dropdownOneValues: {
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10
      },
      local!dropdownTwoValues: {
        "One",
        "Two",
        "Three",
        "Four",
        "Five",
        "Six",
        "Seven",
        "Eight",
        "Nine",
        "Ten"
      },
      local!tmpDropdownOneLabels,
      local!tmpDropdownTwoLabels,
      local!tmpDropdownOneValues,
      local!tmpDropdownTwoValues,
      local!dropdownOne,
      local!dropdownTwo,
      with(
        {
          a!multipleDropdownField(
            label: "Dropdown One",
            labelPosition: "ABOVE",
            placeholder: "-- Select values in Dropdown One --",
            choiceLabels: 
              local!dropdownOneLabels
            ,
            choiceValues: 
              local!dropdownOneValues,
            value: local!dropdownOne,
            saveInto: {
              local!dropdownOne,
              a!save(
                local!dropdownTwo,
                {}
              ),
              a!save(
                local!tmpDropdownTwoLabels,
                index(
                  local!dropdowntwoLabels,
                  wherecontains(
                    local!dropdownOne,
                    local!dropdownOneValues,
                    
                  ),
                  {}
                )
              ),
              a!save(
                local!dropdownTwo,
                local!tmpDropdownTwoLabels
              ),
              /*a!save(*/
              /*local!tmpDropdownTwoValues,*/
              /*index(local!dropdowntwoLabels,wherecontains(*/
              /*local!dropdownOne,*/
              /*local!dropdownOneValues,             */
              /*),{})*/
              /*index(*/
              /*local!dropdownTwoValues,*/
              /*local!dropdownOne,*/
              /*{}*/
              /*)*/
              /*)*/
              
            }
          ),
          a!multipleDropdownField(
            label: "Dropdown Two",
            labelPosition: "ABOVE",
            placeholder: "-- Select values in Dropdown Two --",
            choiceLabels:
              local!dropdownTwoLabels,
            choiceValues: 
              local!dropdownTwoValues
              ,
            value: local!dropdownTwo,
            saveInto: {
              local!dropdownTwo,
              a!save(
                local!dropdownOne,
                {}
              ),
              a!save(
                local!tmpDropdownOneLabels,
                index(
                  local!dropdownOneLabels,
                  wherecontains(
                    local!dropdownTwo,
                    local!dropdownTwoValues,
                    
                  ),
                  {}
                )
              ),
              a!save(
                local!dropdownOne,
                local!tmpDropdownOneLabels
              ),
              a!save(
                local!tmpDropdownOneValues,
                index(
                  local!dropdownOneValues,
                  local!dropdownTwo,
                  {}
                )
              )
            }
          )
        }
      )
    )

Reply
  • 0
    Certified Lead Developer

    I modified your code as per my understanding of the requirement. Can you try the below code and let me know if it fits your requirement. 

     

    load(
      local!dropdownOneLabels: {
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10
      },
      local!dropdownTwoLabels: {
        "One",
        "Two",
        "Three",
        "Four",
        "Five",
        "Six",
        "Seven",
        "Eight",
        "Nine",
        "Ten"
      },
      local!dropdownOneValues: {
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10
      },
      local!dropdownTwoValues: {
        "One",
        "Two",
        "Three",
        "Four",
        "Five",
        "Six",
        "Seven",
        "Eight",
        "Nine",
        "Ten"
      },
      local!tmpDropdownOneLabels,
      local!tmpDropdownTwoLabels,
      local!tmpDropdownOneValues,
      local!tmpDropdownTwoValues,
      local!dropdownOne,
      local!dropdownTwo,
      with(
        {
          a!multipleDropdownField(
            label: "Dropdown One",
            labelPosition: "ABOVE",
            placeholder: "-- Select values in Dropdown One --",
            choiceLabels: 
              local!dropdownOneLabels
            ,
            choiceValues: 
              local!dropdownOneValues,
            value: local!dropdownOne,
            saveInto: {
              local!dropdownOne,
              a!save(
                local!dropdownTwo,
                {}
              ),
              a!save(
                local!tmpDropdownTwoLabels,
                index(
                  local!dropdowntwoLabels,
                  wherecontains(
                    local!dropdownOne,
                    local!dropdownOneValues,
                    
                  ),
                  {}
                )
              ),
              a!save(
                local!dropdownTwo,
                local!tmpDropdownTwoLabels
              ),
              /*a!save(*/
              /*local!tmpDropdownTwoValues,*/
              /*index(local!dropdowntwoLabels,wherecontains(*/
              /*local!dropdownOne,*/
              /*local!dropdownOneValues,             */
              /*),{})*/
              /*index(*/
              /*local!dropdownTwoValues,*/
              /*local!dropdownOne,*/
              /*{}*/
              /*)*/
              /*)*/
              
            }
          ),
          a!multipleDropdownField(
            label: "Dropdown Two",
            labelPosition: "ABOVE",
            placeholder: "-- Select values in Dropdown Two --",
            choiceLabels:
              local!dropdownTwoLabels,
            choiceValues: 
              local!dropdownTwoValues
              ,
            value: local!dropdownTwo,
            saveInto: {
              local!dropdownTwo,
              a!save(
                local!dropdownOne,
                {}
              ),
              a!save(
                local!tmpDropdownOneLabels,
                index(
                  local!dropdownOneLabels,
                  wherecontains(
                    local!dropdownTwo,
                    local!dropdownTwoValues,
                    
                  ),
                  {}
                )
              ),
              a!save(
                local!dropdownOne,
                local!tmpDropdownOneLabels
              ),
              a!save(
                local!tmpDropdownOneValues,
                index(
                  local!dropdownOneValues,
                  local!dropdownTwo,
                  {}
                )
              )
            }
          )
        }
      )
    )

Children
No Data