Get a single record from a database filtered by category_id and then randomised id
Options
Steve Wright-2225084
Member ✭
I have a list of prompts that are all categorised. I want to set up an API to GET a single record, randomly, from a specific category.
I can easily filter by category ID and fetch a list of all prompts, but I can't see how to only select one from within that category and randomise which is picked.
Any help much appreciated!
Table structure:[Screenshot 2022-01-21 at 14.05.42.png]
Thanks
I can easily filter by category ID and fetch a list of all prompts, but I can't see how to only select one from within that category and randomise which is picked.
Any help much appreciated!
Table structure:[Screenshot 2022-01-21 at 14.05.42.png]
Thanks
Comments
-
This is all done in the Return section of Query All Records. Set the return type to single and add a random sort:
[CleanShot 2022-01-21 at 09.12.17.png] -
Thanks! All working
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