Get first 20 records
Hi, I'm looking to achieve the following scenario.
I currently have a database call that gets all records, and includes pagination (this shows 28 records per page)
If the user is not on a premium plan, however, I only want them to be able to see 20 items maximum. How can I limit the amount of items that I retrieve from the database to 20?
Answers
-
Hi, Jack. Following our education on RBAC (video here), you can modify this approach to change the query based on what the user is returned via external paging.
External paging allows you to specify paging details from a variable or an input. So, once you grab the user record and determine their role (or extract it from the auth token, whichever method you choose is valid), you can use a conditional if/then statement to set the page and per_page values before running the query.
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