The community member is using Google Sheets as a CMS, with linked images from Google Drive and a table turned into a JSON via Google Apps Script. They can bind components to single data points and load all the data dynamically into a Collection, but they want to only load certain parts of the data (e.g. [0] to [50] for "great fruit" and [51] to [100] for "great cakes") in different parts of their website.
The community member tried using expressions like "things.data[0-50]" and "things.data.slice(0,51);" but is unsure if this is possible. They ask if they can only load part of the JSON into a Collection, by filtering or using an if-clause based on the categories in their table.
In the comments, another community member suggests using the "Show" setting on the Collection item to filter the data, for example by setting "CollectionItem.category === 'great fruit'". This seems to be the answer to the community member's question.
Hi, I‘m new to Webstudio and I hope I‘m asking this in the right place :)
I’m using Google Sheets as a CMS with linked images from Google Drive and with the table turned into a JSON via Google Apps Script. So this is about loading data dynamically.
It works well to bind components to single data points (like things.data[2].image) as well as loading all the data dynamically into a Collection, it all displays correctly.
Now my issue is that in some places of my website I only want some parts of my data, for example [0] to [50] are of the category „great fruit“ while [51] to [100] is „great cakes“ (the namings are just examples).
I tried things like „things.data[0-50]“ and „things.data.slice(0,51);“ but I start feeling that maybe this isn’t possible?
Can I only load part of my JSON into a Collection? By for example filtering it somehow or specifying with an if-clause, because I do have categories in my table by which I could filter but I don’t really know where to put any of that or how.
I‘m trying to make galleries that follow certain categories with that. I could create different tables per category, but I‘d rather find a better solution in case there is one.