Creating variables


Does anyone know if it is possible to -

  • retrieve some data (in my case Airtable) and use the values as a field name in a second search module?

In a nutshell, I’d like my Airtable data to contain the names of fields to be retrieved in another Airtable base - so that I can make some custom reports / tables.


Here’s how you can approach this scenario:

  • Use the “Search Records” module in to retrieve the data from your first Airtable base. This module will provide you with a list of records, each containing field names and their corresponding values.
  • Add an “Array Iterator” module after the “Search Records” module to iterate through each record in the list.
  • Inside the array iteration, you can use dynamic field mapping to extract field names from the current record. Map the field names to a variable using the “Set Variable” module.
  • Add a “Search Records” module for your second Airtable base. In the field mapping, use the variable that contains the dynamic field name as the field name to search for.
  • The array iteration will repeat these steps for each record, dynamically using the field names to search for corresponding values in the second Airtable base.
  • Once you have the records from the second Airtable base, you can map the retrieved data to create custom reports or tables.
    Best Regards

That’s great!

Makes perfect sense. Many thanks for your help. Much appreciated.


My apologies, I thought this made sense, but I have just been trying it out and can’t get it to work. I may not have explained it very well though.

The “Main” Airtable table will have a record with fields called COLUMN A, COLUMN B and COLUMN C

The values of these three fields, would indicate which columns to retrieve from the second Airtable table. (I am creating an HTML table with only 3 columns, and want to be able to set in the first Airtable table which 3 fields are to be retrieved)

The first search will only retrieve one record - with the names of the 3 fields that need to be retrived from the second table.

I tried setting 3 variables (COL A, COL B, COL C) to the value of the fields to the first table - but of course I can’t then use the VALUES of the variable as fields names when creating the HTML.

Is it a dynamic variable I need? Not sure now if it is - apologies, I am not a programmer.


Hi @Pro_Tanvee

Sorry to bump, but am wondering if you had a chance to take a look? I am not sure if I mis understood your post, or whether I am not making myself clear!

Hi Andrew, I think I understand what you are getting after and it’s a bit of a fun challenge so I put together an example scenario blueprint and some instructions. This use case does, indeed, have a bit of complexity to it. But it can totally be done.

Here’s a picture of the scenario overall

Module 1 - Use Airtable Search Records to “Get Field Names from Main Table”
This should be pretty straight forward.

Module 2 - Use Airtable Make an API Call to “Search Second Table”
This is the biggest trick. You have to do the search with this module so you can access the information from the table dynamically.
In the screenshot you can see the URL is basically v0/{{baseID}}/{{table Name}}?maxRecords={{number}}
This produces the same as the Search Records module, but with a slightly different data structure that we can bend towards our will.

Module 3 - Use an Iterator to loop through each of the records returned from the previous module
This normally happens automatically with a Search Records Module, so we do it manually here.

Module 4 - Use a Set Variable module to dynamically set the value of the fields.
Here we use a get function to get a value of a specific field in a collection (in this case the fields collection).

Here’s a scenario blueprint that might be useful. Of course, you’ll need to swap out connection information and specific Base, table, field names, etc. Note: the blueprint includes notes as well.
blueprint - 2023-08-10T140413.257.json (15.5 KB)

Hope that helps (otherwise, that was a good exercise for me). Cheers.

That’s superb! Thanks so much. This worked perfectly. I had spent so much time fiddling about - this really helped.

Quick question - you used get() to match the variable. How does that differ to the map() function? From what I read - I thought it should be map() - but glad you pointed that out for me!

Thanks again - much appreciated.


I am so glad to hear that worked. Regarding your question on get() vs map():

map() is always used on an array (essentially a list of things). For example, if I had a list of books, I could look for the book titles where Author equals “Tolkien”. Importantly, this could theoretically return multiple items (an array).

get() can be used with an array or a collection. When used with an array, I am grabbing a specific item (like the 3rd book). When used with a collection, I am grabbing some specific value of the collection like the title. This always returns just one thing.