Rollup based on array within array (Xano addon)

Hi all,

Following this tutorial here:

In the tutorial, the addon is based on Location within Cars.data.

How to rollup based on an array within array (Xano addon)?
For instance, I have a collection Products.
Products has an addon: {}_company
Within _company I would like to rollup based on company_name.

Any idea how to do it?

If I understand your data structure correctly, you could use a rollup inside a rollup :grinning:

In your case, “company” would be “_company” and “name” would be “company_name”

The trick is to take it step by step.

Step 1 - I make sure my data structure is clear

Step 2 - I get my list of companies from the initial array

Step 3 - I get the list of names of those companies

Step 4 - I make sure I don’t get duplicates by changing the default distinct parameter to true

Does that work well for your use case?

Hi Joyce,

Thanks for your support. I Managed to rollup the company names, now trying to add corresponding products below the company names as well.

To clarify my case, I added a screenshot. The idea is that all products linked to companies, are showed in a separate list/table below each company name. Not sure how to do it correctly.
Also, when a company’s products are all filtered out the company itself should be hidden. Is this workable?

Many thanks in advance.

Yes! It’s possible :slight_smile:

We have a similar use case in level 2 of the Academy where we have a list of tickets, we group them by status, and we can also filter them out.

Here’s the video on how we use the filterByKey formula to group similar items together.

Does that help?

Thanks for the video. Now I create the groups (Suppliers) and records (Offers) but am not able to follow the rest of the tutorial (1. edit formula for group container and 2. filterkey based on supplier)

  1. I want to group based on Supplier, which is array within the item array. How to set up the formula to have dynamic key values (instead of [“new”, “done”, etc]

  2. How to filterkey() based on an array with the array?


Scherm­afbeelding 2023-12-27 om 15.58.33

Hi Joyce,

I made some progress but everything is still a mess, please see below. Also, I am unable to hide a company name when they don’t offer any product within the selected category.
Do you have any idea to bring some logic to it?

Many many thanks in advance :smiley:



Hi @Philip1 :wave:

It seems to me that you are struggling with binding logic. I think it’s important you take the time to master this because otherwise you will continue to get stuck.

I’d recommend:

  1. (if you haven’t already) taking the time to go through the two courses of the Academy, especially the display data sections of each course, and

  2. attending our weekly Office Hours