issue in dropdownFieldByIndex() when setting the value based on choiceLabels

Certified Associate Developer

My requirement is to display current month as default option in dropdown and user can change month value from dropdown if they want to change and for each month there should be integer value saved in Rule Input "selectedMonth", so I have applied dropdownFieldByIndex() function for this. If user select blank then it will revert it to current month but I am getting below issue:

SAIL Code:

local!currMonth: datetext(today(),"M"),
local!monthName: {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},

a!dropdownFieldByIndex(
label: "",
labelPosition: "ABOVE",
placeholder: "--Select Month--",
choiceLabels:union(local!monthName,local!monthName),
/*choiceValues: tointeger(union(local!monthValue,local!monthValue)),*/
value: if(rule!APN_isNotBlank(ri!selectedMonth),ri!selectedMonth,local!currMonth),
saveInto:ri!selectedMonth,
searchDisplay: "ON"
)

Can anyone help with this what is the issue?

  Discussion posts and replies are publicly visible

Parents
  • I've copied your code into the Appian environment I am working in and it seems to work for me .The only thing I had to change was that I don't have access to rule!APN_isNotBlank:

    a!localVariables(
      local!currMonth: datetext(today(),"M"),
      local!monthName: {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},
    
      a!dropdownFieldByIndex(
        label: "",
        labelPosition: "ABOVE",
        placeholder: "--Select Month--",
        choiceLabels:union(local!monthName,local!monthName),
        /*choiceValues: tointeger(union(local!monthValue,local!monthValue)),*/
        value: if(rule!GBL_isNotBlank(ri!selectedMonth),ri!selectedMonth,local!currMonth),
        saveInto:ri!selectedMonth,
        searchDisplay: "ON"
      )
    )

    ...otherwise it's identical to what you've provided., I do not see an error.

    There is a possibility that you're passing 0 in the value of ri!selectedMonth from, say, a process that has this User Interface inside a User Input Task...in which case you need to default the value to null and not 0

Reply
  • I've copied your code into the Appian environment I am working in and it seems to work for me .The only thing I had to change was that I don't have access to rule!APN_isNotBlank:

    a!localVariables(
      local!currMonth: datetext(today(),"M"),
      local!monthName: {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"},
    
      a!dropdownFieldByIndex(
        label: "",
        labelPosition: "ABOVE",
        placeholder: "--Select Month--",
        choiceLabels:union(local!monthName,local!monthName),
        /*choiceValues: tointeger(union(local!monthValue,local!monthValue)),*/
        value: if(rule!GBL_isNotBlank(ri!selectedMonth),ri!selectedMonth,local!currMonth),
        saveInto:ri!selectedMonth,
        searchDisplay: "ON"
      )
    )

    ...otherwise it's identical to what you've provided., I do not see an error.

    There is a possibility that you're passing 0 in the value of ri!selectedMonth from, say, a process that has this User Interface inside a User Input Task...in which case you need to default the value to null and not 0

Children