Hi team,
When I am choosing multiple options at one particular time I am getting this error. Please help me to solve this error.
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!forEach [line 42]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!multipleDropdownField [line 199]: Invalid index (5) for list: valid range is 1..4
a!localVariables( local!pets:rule!SHA_refPets(), local!selectedValue:index(ri!pets, "petsIdFk", null()), local!originalArray: a!refreshVariable( value: local!selectedValue, refreshOnReferencedVarChange: false ), local!delete, local!insert, local!update, local!deleteCDT, local!insertCDT, local!updateCDT, local!mappingId:index(local!mappingKey,fv!index,null), { a!multipleDropdownField( label: "Pets" , placeholder: "select a value", choiceLabels: index(local!pets, "petsNm", null()), choiceValues: index(local!pets, "petsId", null()), value: local!selectedValue[wherecontains(true(),ri!pets.isActive)], saveInto: { local!selectedValue, a!save( local!update, intersection( tointeger(local!selectedValue), tointeger(local!originalArray) ) ),/*getting updated item*/ a!save( local!delete, difference( tointeger(local!originalArray), tointeger(local!selectedValue), ) ),/*getting deleted item*/ a!save( local!insert, difference( tointeger(local!selectedValue), tointeger(local!originalArray), ) ),/*getting new item*/ a!save( local!insertCDT, a!forEach( items: local!insert, expression: 'type!{urn:com:appian:types:SHA}SHA_newPets'( petsId: null, listingIdFk: index(ri!pets.listingIdFk, 1, null), petsIdFk: fv!item, mappingKey: null, isActive: true ) ) ),/*Creating CDT for new item*/ a!save( local!deleteCDT, index( ri!pets, wherecontains( tointeger(local!delete), tointeger(ri!pets.petsIdFk) ) ) ),/*getting deleted index item*/ a!save( local!deleteCDT, a!forEach( items: local!deleteCDT, expression: 'type!{urn:com:appian:types:SHA}SHA_newPets'( petsId: fv!item.petsId, listingIdFk: fv!item.listingIdFk, petsIdFk: fv!item.petsIdFk, mappingKey: fv!item.mappingKey, isActive: false, createdBy: fv!item.createdBy ) ) ),/*CDT Creation for Deleted item*/ a!save( local!updateCDT, index( ri!pets, wherecontains( tointeger(local!update), tointeger(ri!pets.petsIdFk) ) ) ),/*getting updated item index*/ a!save( ri!pets, reject( fn!isnull, append( local!updateCDT, local!deleteCDT, local!insertCDT ) ) )/*Final*/ } ) }
Discussion posts and replies are publicly visible
when you say "displaying the items", do you mean as choices or as selected values? If de-selecting them causes them to get an active status of "false", i'm not sure what's happening. Again I must point to my points of advice above and strongly recommend you simplify down to something you understand (and that works), and build up from there.
"displaying the items" means the choices which i am selecting in multidrop down
Mike Schmitt thanks a lot for your replies, sure i will try your suggestions