Configure an Array Picker

SAIL Recipes give you an opportunity to explore different interface design patterns. To learn how to directly use SAIL recipes within your interfaces, see Adapt a SAIL Recipe to Work with My Applications.


Allow users to choose from a long text array using an auto-completing picker.

Also, allow users to work with user-friendly long labels but submit machine-friendly abbreviations.

This design pattern is not recommended for offline interfaces because reflecting immediate changes in an interface based on user interaction requires a connection to the server.


The main expression uses a supporting rule, so let's create that first.

  • ucArrayPickerFilter: Scans labels that match the text entered by the user and returns a DataSubset for use in the SAIL picker component.

Create expression rule ucArrayPickerFilter with the following rule inputs:

  • filter (Text)
  • labels (Text Array)
  • identifiers (Text Array)

Enter the following definition for the rule:

  local!matches: where(
      items: ri!labels, 
      expression: search( ri!filter, fv!item)
    data: index( ri!labels, local!matches), 
    identifiers: index( ri!identifiers, local!matches)

Now that we've created the supporting rule, let's move on to the main expression.


  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" },
    label: "State of Residence",
    instructions: "Value saved: " & local!pickedState,
    placeholder: "Type to select the employee's state of residence",
    maxSelections: 1,
    suggestFunction: rule!ucArrayPickerFilter(
      filter:_ , 
      labels: local!stateLabels, 
      identifiers: local!stateAbbreviations
    selectedLabels: a!forEach(
      items: local!pickedState,
      expression: index(local!stateLabels, wherecontains(fv!item, local!stateAbbreviations))
    value: local!pickedState,
    saveInto: local!pickedState

Test it out

  1. Type in the picker field. Even if you don't know for sure how to spell the state you want or what its abbreviation is, the picker constrains your choices to valid states.
  2. Select a state. Notice that because of the maxSelections configuration, once you select a state you must remove the selected state first before selecting an new state.
  3. Remove a selection by clicking on the X after the label. Now you can add another one.

Notable Implementation Details

  • A support rule is needed for the suggestFunction because we need to partially evaluate the suggested filter.