Get a list of kids based on the grandparent
Options
![Robin C](https://us.v-cdn.net/6037124/user_avatars/4155299.jpg)
Robin C
Member ✭
Ok it's a bit weird but it is a good metaphore of what I am facing now.
Let's say you have a nested database like this :
grandparent -> parents -> children.
How would you configure your endpoints so that by inputing a grandparent you have it's grandchildren.
Should I use addons ? Or is it another way to do this ? If yes which one is the best regarding app performance ?
Let's say you have a nested database like this :
grandparent -> parents -> children.
How would you configure your endpoints so that by inputing a grandparent you have it's grandchildren.
Should I use addons ? Or is it another way to do this ? If yes which one is the best regarding app performance ?
Comments
-
Hey, Robin! Addons would be what you want here.
-
Actually not really, is there a way to query all grandchildren which father's father is a particular data ?
My case is an app with cities -> shops -> products. If I want to query all the products of a certain city, I am forced to GET a city, in which i GET all the shops, in which i GET all the products.
And this cause 2 problems :
• First, I am almost sure that it is not super effective
• All my products are getting ordered by shops as I am not directly getting the products but the city they are in
What do you think ? Can't I do something with joins or custom query ? -
You should be able to accomplish this with joins and a custom query as well. Going off of your original example, what I have here is a database structure where the children table has a reference to the parent table, and the parent table has a reference to the grandparent table.[image.png]So, if we then query all records from the children table as grandchildren, we can use joins to create that link between the children table and the parent table, and then the parent table to the grandparent table, and finally use a custom query along with our input to get our response.
[image.png] -
Wow thank you very much, it is exactly what I was searching for ! You made my day !
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