Iterate through getrecords collection

I`ve a basic getRecords collection through rest API call to airtable.

I’ll want to iterate for every record of this recordsCollection and, inside the loop, do another test API call (getRecord).

A typical sample will be get a list of car brands and, for every brand, do a getdetail of this brand (or for example get the list of models of every brand elememte) and show all of this in an app with two nested lists

Thanks in advance

Hi Antonio,

The way that I would approach this is to watch for the data change event for your primary variable (e.g. car_brands) and then use a custom function to read in the variable and iterate over all of the brands to capture the brand detail for each and place it in another variable (e.g. car_brand_details).

You could also just have the car_brands variable to be updated with the details object e.g.

{
   id: uuid,
   brand_label: text
   brand_details: object
}

Depending on how you want to display this, you can repeat on the brands and then use the current.brand_details, or a formula binding the current.id to the pageVars.brand_details, to show the additional details in a subfield of the repeated view component.

I hope that make sense.

1 Like