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
while deselecting the item, the item will not be deleted from the drop down only it will disappear from the value field and the respective pet status become inactive but it is still there in the drop-down so that you can select and make the status active
mamathak0001 said:will not be deleted from the drop down only it will disappear from the value field
What "value field" are you referring to?
the below one:
a!multipleDropdownField( value:)
But the only thing needed for that is to deselect it from the dropdown value. No special extra saves or data filtering on the values variable is needed.
sorry wrongly highlighted
This appears to be a picture of the (collapsed) multiple dropdown field - what I said above still applies. The only thing needed to "remove" values from this is to deselect them as normal.
no i want to store the deselected values also with status as inactive (active=false)
that's fine - the logic you're doing in the saveInto field appears to be handling this (assuming it works), but my point is that you do *not* need to do manipulation on the "value" parameter like you're currently doing. The "value" parameter should simply point at the "selected values" array.
I tried with "selected values" also, the problem I am facing is "it is displaying the items with status(active=false) so I need a condition which will display only items with status(active=true)
1. To get the items with status(active=true) i have written the condition wherecontains(true,ri!pets.isActive) but it is failing