I have created these two below Expression :
a!localVariables( local!matches: where( a!forEach( items: ri!labels, expression: search( ri!filter, fv!item) ) ), a!dataSubset( data: index( ri!labels, local!matches), identifiers: index( ri!identifiers, local!matches) ))UI Snippet :
a!localVariables( local!pickedState, local!stateLabels: { "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" }, local!stateAbbreviations: { "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY" }, local!allAddress:{ ADDRESS_TEXT_ID:local!stateLabels, ID:local!stateAbbreviations },a!pickerFieldCustom( label: "Pick address", labelPosition: "ABOVE", instructions: "", helptooltip: "Start typing address text ID and address containing input string will be shown", placeholder: "---Type address text ID ---", maxselections: 1, suggestFunction: rule!LIMSCN_SupplierArrayPickerFilter( filter:_ , labels: index(local!allAddress,"ADDRESS_TEXT_ID",null), identifiers: index(local!allAddress,"ID",null) ), selectedLabels: a!forEach( items:local!pickedState, expression: index(index(local!allAddress,"ADDRESS_TEXT_ID",null), wherecontains(tointeger(fv!item), tointeger(index(local!allAddress,"ID",null)))) ),
value:local!pickedState, saveInto:local!pickedState, validations: {} ))
And I am getting below error Interface Definition: Expression evaluation error at function a!pickerFieldCustom [line 9]: Cannot index "data" because it is an array type (List of Variant). Only fields with scalar types can be indexed from an array.
Discussion posts and replies are publicly visible
I couldn't replicate your issue but did see your selected labels didn't look right (ie. Using tointeger() on text). See below for the slight change I made. Can you confirm if you can get this example to work?
a!localVariables( local!pickedState, local!stateLabels: { "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" }, local!stateAbbreviations: { "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY" }, local!allAddress: { ADDRESS_TEXT_ID: local!stateLabels, ID: local!stateAbbreviations }, a!pickerFieldCustom( label: "Pick address", labelPosition: "ABOVE", instructions: "", helptooltip: "Start typing address text ID and address containing input string will be shown", placeholder: "---Type address text ID ---", maxselections: 1, suggestFunction: rule!ASB_PickerSuggestFunction( filter: _, labels: index( local!allAddress, "ADDRESS_TEXT_ID", null ), identifiers: index(local!allAddress, "ID", null) ), selectedLabels: a!forEach( items: local!pickedState, expression: index( index( local!allAddress, "ADDRESS_TEXT_ID", null ), wherecontains( fv!item, touniformstring(a!flatten(index(local!allAddress, "ID", null))) ) ) ), value: local!pickedState, saveInto: local!pickedState, validations: {} ) )
Is working fine for me...
What is the data type of you rule input parameters? I've defined as Text (array)
Were you able to replicate the error? In my case it worked fine without any modifications... The only thing I can think of is that the error is in the signature of the rule
Without modifications it "worked" (ie. Didn't throw the error that they were getting) but it always selected Alabama as the state. I tried changing around the inputs of the suggest function but still couldn't get the error.
Isn't this sample the same that can be found in appian documentation?
docs.appian.com/.../recipe-configure-an-array-picker.html