Skip to main content
kavyam0002
January 5, 2025
Question

default value

  • January 5, 2025
  • 2 replies
  • 0 views

in dropdown i have to show default values then it has only single value if dropdown has multiple choices i can show then value will be null

ex: here detail has many values this i have to show as it is no change in this 

this dropdown has single option so need to show that by default 

    2 replies

    nilanshum856600
    January 7, 2025

    You can check the length of the options and then use them in the value parameter if its 1.

    Here's the code for your reference:

    a!localVariables(
      local!options: {"a"},
      local!selectedValue: if(
        length({local!options}) = 1,
        local!options,
        null
      ),
      {
        a!dropdownField(
          label: "dropdown",
          choiceLabels: local!options,
          choiceValues: local!options,
          placeholder: "--select a value--",
          value: local!selectedValue,
          saveInto: local!selectedValue
        )
      }
    )

    Let me know if you need any other support.

    mikes0011
    Brainy
    January 7, 2025

    Note, this is a duplicate post of the one seen here.