Use SetFilter to apply filter to a table -- struggling with syntax

Hello,

I am using a filter to filter my table, and then I call a JS query to getDisplayedData to show this filtered data in a chart. Whenever I reload my page, however, all my filters get reset, so I was wondering if I can put in a button to set filters and then run my JS queries. I know how to get a button to run my queries (very easy), but I'm struggling with the syntax of set filter. How do I do it?

I have a few use cases. One of which is filter the table where is_original_entry is true. Another is filter the table where is_original_entry is true and is_new_customer is true. There are other exampels where I want both of these applied and also status != "confirmed"

For some context, we are a medical appointment booking software company, so it's important to know how many bookings were getting per month, how many new customers we're getting per month, how many visits we have completed / canceled (aka that's why we're filtering out the confirmed status appts because those haven't happened yet).

Any advice? Thank you

Also, let it be known that I am not married to this approach. Happy to try using transformers or a new query or whatever. I'm just not that used to coding in general and have trouble understanding how all the building blocks interact with one another, not to mention not having a super good handle on the syntax.

Hi @tommyg! This doc has some examples of how to use the Table's filter methods:

The Table's "Default filters" property may also be useful here!

If you're not showing the Table at all though and instead just relying on its functionality to filter data, you may be better off filtering the data returned by the query using SQL.

1 Like