Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

getting error in Multiple dropdown field.

Certified Associate Developer

Hi Team,

Below is my code snippet, i hope i have handled the null but still am getting. can you please guide where it went wrong.

local!salesReps:index(rule!GSE_SCL_QRY_getViewIntakeDetails(
region:local!region,
sipYear:local!year,
pagingInfo:a!pagingInfo(1,-1)
).data,"Name",null),
local!repChoice:{union(local!salesReps,local!salesReps)},
local!salesRepName: if(a!isNullOrEmpty(local!repChoice),"None","All reps"),

a!multipleDropdownField(
label:"Sales rep name",
choiceLabels: if(a!isNullOrEmpty(local!repChoice),
{"No reps"},
{"All reps",local!repChoice},
),
choiceValues: if(a!isNullOrEmpty(local!repChoice),
{"None"},
{"All reps",local!repChoice},
),
value:local!salesRepName,
saveInto: local!salesRepName
)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hi  , 
    In the given code, I noticed that the local variables you created are not wrapped inside the localVariable() function. Additionally, the local variable: salesReps contains null values, which is causing an error. Please add proper null handling and check this after making the changes.

  • +1
    Certified Senior Developer
    in reply to Harshmodi

    Can take reference from this code: 

    a!localVariables(
       /*----- reject function will remove null values from the list ----------*/
    local!salesReps:reject(fn!isnull,{"A","B","C",null}),
    local!repChoice:{union(local!salesReps,local!salesReps)},
    local!salesRepName: if(a!isNullOrEmpty(local!repChoice),"None","All reps"),
    
    a!multipleDropdownField(
      label:"Sales rep name",
      choiceLabels: if(a!isNullOrEmpty(local!repChoice),
      {"No reps"},
      {"All reps",local!repChoice},
      ),
      choiceValues: if(a!isNullOrEmpty(local!repChoice),
      {"None"},
      {"All reps",local!repChoice},
      ),
      value:local!salesRepName,
      saveInto: local!salesRepName
    )
    )

Reply
  • +1
    Certified Senior Developer
    in reply to Harshmodi

    Can take reference from this code: 

    a!localVariables(
       /*----- reject function will remove null values from the list ----------*/
    local!salesReps:reject(fn!isnull,{"A","B","C",null}),
    local!repChoice:{union(local!salesReps,local!salesReps)},
    local!salesRepName: if(a!isNullOrEmpty(local!repChoice),"None","All reps"),
    
    a!multipleDropdownField(
      label:"Sales rep name",
      choiceLabels: if(a!isNullOrEmpty(local!repChoice),
      {"No reps"},
      {"All reps",local!repChoice},
      ),
      choiceValues: if(a!isNullOrEmpty(local!repChoice),
      {"None"},
      {"All reps",local!repChoice},
      ),
      value:local!salesRepName,
      saveInto: local!salesRepName
    )
    )

Children