Custom picker for dummies

I've been trying to figure out step by step how to create my own address picker.

Most of the questions I've run into here are too specific and don't cover basics. Also, I didn't find an example or tutorial in the online Appian course for this topic.

So, please help! Slight smile

This is my case:

Simple address table example (table has some more columns but I believe they are irrelevant for this story):

ID : 1
ADDRESS_TEXT_ID: "3RD AVENUE-15-NEW YORK-55555"

ID : 2
ADDRESS_TEXT_ID: "5TH AVENUE-10A-LOS ANGELES-12345"

ID : 3
ADDRESS_TEXT_ID: "UPPER STREET-14-AUSTIN-52154"

What I need is a picker that starts searching my address database table with rows like those above after I type at least 3 characters. It allows only 1 selection that needs to be represented with address text (label) and stored as its numerical ID in rule input (rule input is CDT, so the input field should be ri!employee.addressId). 

This is the rule I've created for search:

a!queryEntity(
  entity: cons!EEDM_ADDRESS_DATA_STORE_ENTITY,
  query: a!query(
    logicalExpression: a!queryLogicalExpression(
      operator: "AND",
      filters: {
        a!queryFilter(
          field: "addressTextId",
          operator: "includes",
          value: upper(ri!searchText)
        )
      },
      ignoreFiltersWithEmptyValues: true
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: 50
    )
  ),
  fetchTotalCount: false
).data

This is my custom picker code now:

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!EEDM_SearchAddressByString(_),
  value: ri!employee.addressId,
  saveInto: ri!employee.addressId,
  validations: {}
)

I know I'm missing some key properties but I don't get how to define them.

Could anyone give me step by step example how to finish this picker?

  Discussion posts and replies are publicly visible