Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Loop over multiple bases?

Topic Labels: API
340 0
cancel
Showing results for 
Search instead for 
Did you mean: 

I’m working on a project that uses multiple bases that all have one table that is identical. I’d like to loop over all of the bases and output the content. I’m missing something for getting this working without creating nested arrays within arrays.

I use this to get the contents currently:

const records = await airtable
  .base("appBaseId01")("Case Overview Information")
  .select()
  .firstPage();

const details = records.map((detail) => {
  return {
    city: detail.get("City") || null,
    name: detail.get("Name") || null,
    state: detail.get("State") || null,
  };
});

return {
  props: {
    details,
  },
};

Does anyone have a recommendation for querying for all of the bases in an array like ["appBaseId01", "appBaseId02", "appBaseId03"] and outputting a single array of objects with the contents of each?

0 Replies 0