Dropdown null value issue

Hi ,

 

I have an issue with dropdown. I want to display current year by default in my year dropdown.

For that i have appended year with the year dataset but its giving me error.

/*placeholderLabel: "--Select a Year-- ",*/ - In this by default current year should be display and selected.

 

Below code i have in load().

local!year1: append(tointeger(todatasubset(
    local!data,
    a!pagingInfo(
      startIndex: 1,
      batchSize: - 1,
      sort: a!sortInfo(
        field: "year",
        ascending: false
      )
    )
  ),year(today()))),
  local!year: if(
    rule!APN_isBlank(
      local!data
    ),
    {},
   union(
      index(
        local!year1.data,
        "year"
      ),
      index(
        local!year1.data,
        "year"
      )
      
    )
  ),

 

a!dropdownField(
label: "Year",
labelPosition: "ABOVE",
/*placeholderLabel: "--Select a Year-- ",*/
choiceLabels: local!Year,
choiceValues: local!Year,
value: local!selectedYear,
saveInto: { local!selectedCycleYear }
)

 

But i am getting error. Could not display interface. Please check definition and inputs.
Interface Definition: Expression evaluation error at function a!dropdownField [line 190]: A dropdown component [label=Year”] has an invalid value for “value”. Value cannot be null.

 

If i un comment this section - /*placeholderLabel: "--Select a Year-- ",*/ 

than its working fine but as per my requirement i don't want to display this text , dropdown should populate with year data along with current year on top of that(In selected mode)

 

What could be the workaround of this problem.

  Discussion posts and replies are publicly visible

Parents
  • Can you try below code

    load(
    local!currentYear:year(today()),
    local!years: append(
    a!forEach(
    {
    10,
    9,
    8,
    7,
    6,
    5,
    4,
    3,
    2,
    1
    },
    local!currentYear - fv!item
    ),
    local!currentYear,
    a!forEach(
    {
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10
    },
    fv!item + local!currentYear
    )
    ),
    local!selectedYear:local!currentYear,
    a!dropdownField(
    label: "Year",
    labelPosition: "ABOVE",
    placeholderLabel: "--Select a Year-- ",
    choiceLabels: local!years,
    choiceValues: local!years,
    value:local!selectedYear,
    saveInto: local!selectedYear
    )
    )
Reply
  • Can you try below code

    load(
    local!currentYear:year(today()),
    local!years: append(
    a!forEach(
    {
    10,
    9,
    8,
    7,
    6,
    5,
    4,
    3,
    2,
    1
    },
    local!currentYear - fv!item
    ),
    local!currentYear,
    a!forEach(
    {
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10
    },
    fv!item + local!currentYear
    )
    ),
    local!selectedYear:local!currentYear,
    a!dropdownField(
    label: "Year",
    labelPosition: "ABOVE",
    placeholderLabel: "--Select a Year-- ",
    choiceLabels: local!years,
    choiceValues: local!years,
    value:local!selectedYear,
    saveInto: local!selectedYear
    )
    )
Children
No Data