Skip to main content
akshayg0010
June 19, 2022
Question

Display Nullvalue in Dropdown by Adding NULL Name

  • June 19, 2022
  • 5 replies
  • 0 views

I am getting values from database and I am displaying it and the filter is working fine. Now the Requirement is i need to add NULL Name in dropdown and display those names that are NULL.

I am using append(local!dropdown,"NULL Name"). 

local!dropdown-- It has a rule that is used to display Dropdown value.

My doubt is I need to Display NULL Name dynamically, i.e: if any value is Null then only i can see this option in dropdown.

I am using below code but its wrong(as am comparing directly with NULL and value can be like: {
Name1,
Name2,
Name3,
Null
}) can someone help me on this

local!dropdownList: if(local!dropdown="NULL", append("NULL Name"),local!dropdown)

    5 replies

    dhananjayk3480
    June 20, 2022

    You need to add logic based on your choice Values.

    local!choiceValue: Get all options from the source { Name1, Name 2, Name3, Null}

    local!noNullChoiceValue: use reject function to discard null. Expected out put as { name1, Name2, Name3 }

    local!option: 

    if   count ( local!choiceValue ) = count ( local!noNullChoiceValue ) then  pass anyone ( local!ChoiceValue or local!noNullChoiceValue)

    Else append ( local!noNullChoiceValue, NULL ),



    a!dropdown(
    .....

    ....

    .....

    Chocie Labesl:local!option


    Choice Values:local!option


    and on selection you know what to do when user select NULL or other options

    July 13, 2023

    local!option: 

    if   count ( local!choiceValue ) = count ( local!noNullChoiceValue ) then  pass anyone ( local!ChoiceValue or local!noNullChoiceValue)

    Else append ( local!noNullChoiceValue, NULL ),



    a!dropdown(
    .....

    ....

    .....

    Chocie Labesl:local!option


    Choice Values:local!option

    Has anyone tried this? 

    I still get the error message "A dropdown component [...] has an invalid value for "choiceValues". Choice values cannot be null.". Of course local!option contains null. Or what am I missing? 

    saahilm4696
    July 13, 2023

    I think you cannot have null as value in the dropdown instead it should be text "Null"

    append ( local!noNullChoiceValue, "NULL" )

    shanmathip7466
    Inspiring
    July 13, 2023

    [mention:b1ade1a559234ce6934bfe6c73a3858c:e9ed411860ed4f2ba0265705b8793d05]

    Is this what trying to get? If the user selects "NULL" in the dropdown, add logic to query the null values otherwise the name which is selected.