How to filter data
Options
GavinReid
Member ✭
Hi all,
How can I filter the data that is called from a Xano table to my frontend? Here are three examples/scenarios:
- Only show upcoming events (not past events) in a feed;
- Fetch certain data by category (e.g. only vegetaian food, only gluten free etc) to be displayed in a feed;
- If a user only wants their post to be available to certain people (e.g. they want to invite males only).
If you can explain how to do this in the simplest terms possible, you will have my eternal respect!
Thanks in advance.
Tagged:
Best Answer
-
Hi @GavinReid here's a very basic example of how to filter records in Xano:
You can apply this framework to all the use cases mentioned above.
- Upcoming events: You'll want to compare your date/timestamp field with the value of now in Xano. (example: event.start_time > now)
- Where event.category = input: category
- Is more of a RBAC/Restricting Access use-case. You'll be able to pull user info with a get record based on the auth token provided. Here's documentation and a tutorial on this type of logic: https://docs.xano.com/building-features/role-based-access
Answers
-
Hi @Michael Udinski, thanks a lot for this!
-
@Michael Udinski, not really a Xano question, but would you have any idea how I would get the filtered data into a feed in draftbit? E.g. a feed that only shows vegetarian food?
-
@GavinReid this should come from the filtered API in Xano, then you'd display the resulting data in Draftbit
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