I’m trying to take a JSON sent through API and grouped by Year, Carrier, Product and display the information in 3 nested repeating groups. The top repeating group separates the data by year, then within each year the data is separated by Carrier using another repeating group and referencing the parent cells year (see screenshot).
Where I’m having trouble is the third set of data, products, which should be filtered by the parent cells carrier and the grandparent cells year. I tried setting a state on the carrier repeating group, but it isn’t possible to set this state via a workflow. I’m guessing because it’s a nested repeating group.
Yes, it is not possible to set a state onto an element within a repeating group from outside of the repeating group, so unless you have a button to press that is in the repeating group, you can not set states on elements within the repeating group.
For your setup, without knowing the exact structure of your API call Object (ie: is the list of objects Products with fields of Year and Carrier on them?), I will make some assumptions in my answer.
Your first Repeating Group that will be the Years will take the API response, filter it by year and use unique elements operator to have just the list of Years and that data type for that RG is number so long as your api response is initialized so that the year value is a number.
Then inside of the Year RG you place another RG, that will be the API response filtered by Carrier and the Year, which will reference the year RG current cells number value. What you are basically trying to do here, is get the unique list of Carriers whose Products have the Year, because in some years a Carrier might not have a product I assume, and so you wouldn’t want to show the Carrier if there are no products.
Then have your final RG nested in to show a filtered list of products whose carrier is current cell carrier and year is the Year value (this would come from a group that contains the Carrier RG and is set to type number), otherwise you won’t be able to reference the number of the year to filter.
An alternative to this, that may work for your use case, which I don’t what the use case is, is to just have a single RG with your API response, sorted by Year, and just show in the text element the name of Carrier and Product, and if you need products sorted in order of carrier, just add a second sort operator after sorting by year to sort by carrier.
It seems to me like 3 nested RGs is over complicating what should just be a single API call response that is a list of products, sorted by year and then sorted by carrier and a text element to display the carrier and product name and even the year if you choose.