Join the Webstudio community

Updated 2 weeks ago

Displaying nested collection Baserow -> WS

I have connected WS with Baserow. Imagine in Baserow there are tables "Categories" and "Subcategories" that are linked each other. "Categories" have a lookup field that shows the array of "Subcategories"
On WS I am getting the "Caregories" and I want to show the "Subcategories" for each "Category". I can get that array field but it only returns the lookup value (e.g. name of "Subcategory") and the "Subcategory" ID.

My goal is to also get the slug of that "Subcategory". I see two ways solving this:
  1. Create another lookup field that displays the "Slugs" array for the "Subcategories". The problem is that I cannot find a way to iterate in WS (e.g. getting an index and display the values from those two fields based on the index)
  2. Create a string field in Baserow combing the two fields with a separator, e.g. "{category_name} | {category_slug}". Then it is easy to fetch it in WS, but I would need to split the two values out of the string. Is this possible in WS?
Or is there a better way to approach it?

Thanks in advance!
J
c
4 comments
I have this column which i think is the same as you. And in my query I add this &field_2998685__join=field_2998661,field_2998684,field_3004070 Which adds fields from the other table. So you can add your slug in there
And iterate with a collection
Awesome! This is exactly what I was looking for, thanks @John Siciliano πŸ‘

I wonder if there may be performance/speed considerations by joining tables via the api
Seems fine πŸ€·β€β™‚οΈ This feature will be a really nice addition https://github.com/webstudio-is/webstudio/issues/4077
Add a reply
Sign up and join the conversation on Discord