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.
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: {} ) )
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.