I am fairly new to Retool and have been fiddling around with filtering a specific column in my table.
The data of the table is populated using API requests on an external service and yields the following view
Then I added a custom script to that component that looks as follows:
var filters = []
if (multiselectExpenseCategory.value.length>=1) {
multiselectExpenseCategory.value.forEach(f => {
filters.push({columnName: "self.expense_category.id",
filterValue: f,
operator: "equals"})
})
}
tableExpenses.setFilters(filters, "or")
Since the multi select component yields the id instead of the name, I also had to adapt the table so that it shows the id in the column Category (the name is now in a custom column category_name):
I have tried all sorts of combinations for the columnName in the filter code: self.expense_category.id, expense_category.id, Category, Category.id, etc. But no luck.