Hi, I’m using the Node library to access the API. As I understand it, when the value in a field is a reference to another table, the only thing that’s returned is the ID of row in that table. So, if I have a Books table and an Authors table and use something like base('Books').select
then it will return an ID for the author instead of the author information. That’s great! The issue I’m running into is: what’s the best way to subquery for that linked data, e.g. to also grab the Author information, in my select
function
I’m trying to build a pretty simple JSON object from Airtable data to pass on as a template context, using Express. Basically, I want to call to the Airtable API, perform a select
, pull all the relevant data, and then pass that data on. For example, if I have a Books
table and an Authors
table, Books
would obviously contain a column with that references Authors
. I want to run a select
function on Books
and grab the authors as well.
My Object would look something like this:
var books = [{ "Title": "The Count of Monte Cristo", "Authors": [{ "Name": "Alexandre Dumas", "Birthdate": "1802-07-24" }] }, { "Title": "The Three Muskateers", "Authors": [{ "Name": "Alexandre Dumas", "Birthdate": "1802-07-24" }] }, { "Title": "Les Miserables", "Authors": [{ "Name": "Victor Hugo", "Birthdate": "1802-02-26" }] }];
However, when I try to use the find
function to grab the author within the loop inside my base('Books').select
function, the find
function runs in a separate thread (I think? I’m new to the Node world of asynchronous functions).
Whew, that’s a lot! I guess what I’m looking for is an example of the select
function that subsequently calls the find
function and is able to associate the record(s) returned by find
with the correct record in the select
Thanks!
J