Filtering Multiple API Get Requests
Options
![Paul Gill](https://us.v-cdn.net/6037124/user_avatars/2167952.jpg)
Paul Gill
Member ✭
I'm working with Xano and Bravo Studio, but I think I might be trying to do something Bravo can't do as it is, so I'm hoping this can be achieved in the back end by using different API Get requests.
I've got a medical section which is getting a little complex; obviously you have the user then 'patient' then brand of med, type of med, batch no, date from, date to, etc.
Bravo will let me do a list, but it will list all the same type of meds together, when I want the meds to be in date order - newest at the top, oldest at the bottom.
As I have a different graphic for each medicine type, I need to bind them to each graphic separately. So one API request for one sort of med, another for another, etc. But then I'd like these requests returned and put in that date order.
I may not be explaining this well..!
I've got a medical section which is getting a little complex; obviously you have the user then 'patient' then brand of med, type of med, batch no, date from, date to, etc.
Bravo will let me do a list, but it will list all the same type of meds together, when I want the meds to be in date order - newest at the top, oldest at the bottom.
As I have a different graphic for each medicine type, I need to bind them to each graphic separately. So one API request for one sort of med, another for another, etc. But then I'd like these requests returned and put in that date order.
I may not be explaining this well..!
Comments
-
Have you check out this page in documentation?
https://docs.xano.com/working-with-data/functions/database-requests/query-all-records/output-tab
I think you could set up your get request like all-medicine/by-type/{type} or all-medicine/by-type/{type}/and-brand/{brand}
Then add a “query all records” with a custom query set to inputs as conditionals. Then you can sort them by date and/or any other field in the record from the output tab.
Here is a support doc for bravo that will probably be most helpful for this scenario.
https://docs.bravostudio.app/bravo-studio-help-center/connnec-api/data-library-connecting-to-apis/data-library-connect-to-any-api-get-request-for-detail-page
Here is an example I tested out.
[03E4F913-6902-494F-A4A3-E5CB1DDB9045] -
Thanks Facundo Lucci I will check all of that out, I very much appreciate your reply. 🙂
-
Ah, so hopefully I can add current meds displayed by themselves, and a full med history in a different page... right, I'll delve into the documentation and see if I can figure it out. 🙂
Thanks again! 🙂 -
So, I would need to do it by patient id then treatment type, then date?
Does that sound about right? -
Is this a good time to confess my last experience with conditionals was on a ZX Spectrum in the 80s? 😀
-
Haha I had to google what the ZX Spectrum was. Nothing to confess though! I’m a non-technical restaurant owner.
If the user also the patient, then patient_id might be better as the conditional on the custom query. If the user is a doctor or administrator, then you could sort as you suggested before. Just want to avoid the user accessing another user’s personal information. -
I used patient for convenience - it's animal and owner 😃
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