Autocomplete data source

If you’re using an AutoComplete, but want to control what data is shown in the SearchList as people type in the input file, how can this be done?

For example, if i have an input, autocomplete and a number of options like this:

And a subscribe method:

this.subscriptions.push(
	this.searchString.valueChanges.subscribe((value) => {
		if (typeof value == 'string') {
			this.filter(value);
		} else {
			if (value) {
				this.add(value);
			}
		}
	})
);

That subscribe method then calls the filter method as follows, which is my attempt to limit the data shown, but it’s not working:

debug('value', value);
const where: any = {};
if (value) {
   where.name = { ilike: `%${value.toLowerCase()}%` };
}
if ('Topic' == this.businessObjectName) {
  debug('reading topics');
  this.topics.setOption('where', where);
  this.topics.read();
} else if ('Person' == this.businessObjectName) {
...
} else {

const userInterface = this.apexDesignerUserInterfacesService.currentUserInterface();

debug('userInterface', userInterface);

throw `The businessObjectName ${this.businessObjectName} is not handled in ${userInterface}, needs to be extended `;

}

The issue may be that you are missing an await on the front of this.topics.read();

Yes, that was it, actually needing to set the method to isAsync and adding the await.
Thanks