How to properly prevent duplicates with Airtable collection?

I’ve created a view for my airtable table which groups the table by year. Which theoretically, should remove duplicates in my airtable collection in weweb.

I expected the fetched data to look like this:

{
  group1: [],
  group2: [],
  group3: [],
  ...
  group100: []
}

or just [group1, group2, group3, ..., group100]

But what was fetched was:

[entry1, entry2, entry3, …, entry100]

Is the intentional or did I miss something? I’m keen on filtering the duplicates at API level since it’s just very slow to query if I don’t remove the duplicates.

Hi @vincedc :wave:

If I understand correctly your use case, I believe this is intentional. When you group items in a table by year, it doesn’t remove duplicates. All the Airtable records are still part of the groups, both in the Airtable view and WeWeb collection.

Can you tell us a bit more about your data set, especially clarify what duplicates you are trying to exclude from the response and/or what data you’re hoping to get in WeWeb?

Perhaps you could achieve what you’d like with a “Filter by formula” at collection level:

It looks like this:

Products

[
  {
    name: "Product A",
    year: 2021
  },
  {
    name: "Product B",
    year: 2021
  },
  {
    name: "Product C",
    year: 2021
  },
  {
    name: "Product D",
    year: 2022
  },
  {
    name: "Product E",
    year: 2023
  },
  {
    name: "Product F",
    year: 2024
  },
]

So we’re using airtable and this query returns about 2k results which is a significant delay in the system. I know we could make a separate table for years field though I don’t think we can use filter by formula for this use-case, unless I’m missing something