Can I get a row count after a filter is applied to a table

I'd like to find out if a filter returned any rows or not. What property of the table will give me how many rows a given filter returned. I really only need to know if it returned any rows.

Hey @George_B!

Happy to help here! Are you using the table components built-in filters? If so, you could take the length of the displayed data to see how many results are being returned after the filter, you could use something like {{table.displayedData.length}}. Do you think this could work for your use case here?

I'm setting the filter based on a text input component. I tried that and it doesn't seem to work. Is it a timing thing?

if (inputTemplateID.value === '') {
  tbl_Templates.setFilters([]);
} else {
  tbl_Templates.setFilters([{ columnName: "_id", filterValue: inputTemplateID.value, operator: "contains" }]);
}

// see if we found anything
if (tbl_Templates.displayedData.length === 0) {
  utils.showNotification({title:"No Approved Template for entered ID", description:"No Approved Template for entered ID! " + tbl_Templates.displayedData.length + ' end', notificationType:"error" }) 
} else {
    utils.showNotification({title:"Found Template for entered ID", description:"Found Template for entered ID! " + tbl_Templates.displayedData.length + ' end', notificationType:"error" }) 
}

Hmm :thinking:, it may be. If you separate this logic and run the second conditional on success of the first, do you get any different results?

Let me try that.

That was it. I needed to wait for the filter to be successfully applied.

Awesome, glad that helped! :slight_smile: