Update table post API query?

I have a table customerTable where Table Data = {{Data.GetCompanyList.data}}.
I have a Input widget named companySearchByName that has no event triggers.
I have a Button widget named findButton that has onClick = {{Data.GetCompanyList()}}.

In Data.js, I have:

export default {
	GetCompanyList: async () => {
		const v = await ApiQuery.run({
			entityName: DataApi.GetCompanyQueryEntity(),
			filters: DataApi.GetCompanyFilters(),
		}).then(DataApi.GetCompanyQueryMapped);
		console.log(v);
		return v;
	},
}

Note that DataApi.GetCompanyFilters() uses companySearchByName.text if there is a value in it, otherwise it returns all rows. Importantly: This works great if I manually Run it. Also, when I click findButton, I see that this runs per console.log() and filters the results exactly as expected when I put data into companySearchByName and click findButton.

So I am able to get both full results and filtered results, but for the filtered results I only see that come through via console.log(). customerTable never updates and instead continues to show full results that loaded on page load.

I’m unsure what I’m doing wrong here…

Shouldn’t customerTable update with the new rows? Instead, it just shows the original rows that loaded when the page loaded (all rows), which is the default return by GetCompanyList().

Should I be using something other than {{Data.GetCompanyList.data}} for the table data for companyTable?

Okay, I figured this out. I saw this question a few times via google, so I’ll document the fix.

The problem I had was that I was trying very hard to abstract away some code, but instead I had to ensure I was calling a query directly in onSearchTextChanged. I did abstract away the mapping of the API response however.

So Table Data is now:

{{DataApi.GetCompanyQueryMapped(apiQuery.data)}}

And onSearchTextChanged is now:

{{
apiQuery.run({
  entityName: DataApi.GetCompanyQueryEntity(),
  filters: DataApi.GetCompanyFilters({
    nameContains: companyTable.searchText
  }),
})
}}

@dppur9876
As the team was away for the weekend, we couldn’t help you out earlier.

Although, great work figuring this out on your own and then documenting it. We really appreciate your contribution to our community!!