Help

Loop over multiple bases?

Topic Labels: API
786 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Dan_Denney
5 - Automation Enthusiast
5 - Automation Enthusiast

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