How to filter records by current month, week, today?
I am trying to create a filter that shows the data from the current month, current week and today. I previously had this filtered by the last 30 days, last 7d days using a timestamp_subtract_days filter with the number of days as input. However I am stuck on figuring out how I can filter by the current month, week. Does anyone know how can I do this?
This is how I have my endpoint right now
Best Answer
-
Hi @rodrigoayala31 - You can leverage the now value and combine it with filters such us "timestamp_month", "timstamp_week", etc.
I also see you have many query all records in your function stack. There's a good chance, depending on what records you're trying to get back, that some or all can be combined by using multiple expressions to filter your records.
Answers
-
@Michael Udinski thank you so much that is really helpful! Actually in my function stack I do have many query all records, just the first one get data as is based on the filter. However the other queries are getting a count of a specific field from each of the records. Perhaps there is a way I can make those queries at the same time?
-
Instead or querying the records again for a count, you could just put the return variable in a create variable function and apply the count filter to it. This will return the total count of records
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback