Filter a metric between two dates

Hello everyone, I am building a web dashboard and I am trying to apply a filter on a metric between dates, for example, I want to be able to get students’ attendance rate between Jan 1, 2022 and Jan 10, 2022.
I have tried applying a filter on the fetched data but the problem is that the date column from Supabase database comes into WeWeb in a string format rather than a date format and as such the possible filter conditions are those that work with strings i.e contains, is, is not, etc. I want to be able to use ‘>=’ and ‘<=’ . I need help figuring this out, thanks!

Hey Bidemi,

You’re right, it’s not easy to do. It would be great to have more flexibility in the front filters and be able to use a full formula such as:
timestamp_conversion_function(timestamp_from_bd) > "2022-01-01"
I think this is coming. I also see the problem when trying to filter using an object property myself.
We could benefit from the new date extension. :heart_eyes:

As a solution for now, you could also do the heavy lifting in your back:

  • either create a view in Supabase with SQL filter to only keep the raws you want (if it’s not a dynamic value) but you’ve got to check if you can later insert/update in a view.
  • or (but it’s not elegant) you might have a column in your DB representing your date as an integer so you can filter in the front with > and <. This column might be auto filled with a trigger and a date conversion function by Supabase.

Hope it helps.


Hello Matthieu,

Thanks for your response and the suggested solutions🙏. Some things are really difficult to achieve at the moment but I’m looking forward to the amazing functionalities coming to WeWeb.

I need the date filtering to be dynamic because users of the dashboard would want to see data and metrics for different periods of time. I believe the 'not so elegant’:grinning: solution would be my best bet. Thanks alot!

1 Like