Managing Hierarchical Data in Xano
Options
![jasem al neaimi](https://us.v-cdn.net/6037124/user_avatars/2459537.jpg)
jasem al neaimi
Member ✭
I would like to create a category tree with nested subs and try to figure it out.
any tips and tricks on how to achieve it in XANO?
any tips and tricks on how to achieve it in XANO?
Comments
-
can you give an example of what your database schema would look like? I'm not entirely following the question.
Are you talking about mutli-level categories? -
I think I figured it out
First I created a category table
[99504618-5326-47E7-B8FA-51D27C460283]
With parent column to reference to the id of the category above
In the example I have 4 categories all 3 are referencing to one
Then I created an addone that will list products by category
[5BDCA406-7009-48FB-9310-CD935B0F0507]
Then I joint it with the category table
[C5ACCCCA-A2D3-4E42-9045-1F482110D32A]
With the where condition above to list all products under the tree of the selected category
Then I created a get api endpoint for categories
[67306C74-47BD-4C0A-B885-ABBC514E45D9]
And added the custom addone I created above
And then added a query condition
[102846B8-4A97-4672-B533-893BE8E03EB0]
With that if I select the top of the tree I get all the products under the tree and so on.
Now is this the right way to create a category tree for a products table or there is a better way? -
the output is wrong. When I call the parent level it’s giving me all
But if I call the base level it’s good -
can you come to office hours? Seems like you are close but it's hard to debug over this forum.
-
noted will do
Thanks
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