Help

JS API ignore lookup fields

Solved
Jump to Solution
1099 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Thomas_Pegler
4 - Data Explorer
4 - Data Explorer

Hi,

I'm working with the NPM package to get data from tables which have lookup fields and I'm wondering if there's a way to ignore these lookup fields in the initial API call either by using some parameter or `filterByFormula`. I've checked the API documentation for my tables, checked the documentation for the Formula field and nothing seems to be able to filter by field type.

EDIT: I guess the question can also become, is there a way to ignore fields when using the `base().select()` method? I have a list of the fields I want to ignore from the Base schema but can't find a way to ignore those fields. I can just drop them from the returned data afterwards but that is going to be fairly expensive as we're processing potentially tens of thousands and eventually millions of records. 

Thanks in advance,

Thomas

1 Solution

Accepted Solutions
Thomas_Pegler
4 - Data Explorer
4 - Data Explorer

I managed to handle this myself by checking fields against the base schema for each base and only getting the fields that weren't lookups.

Get the table schema from

axios.get('https://api.airtable.com/v0/meta/bases/${baseId}/tables')

With this  you'll get all of the information for each table within the base, including all fields, their type , id and name. With the type, you'll get multipleLookupValues, and just collect the name of all other fields and select only those on the select() method using the fields parameter.

See Solution in Thread

1 Reply 1
Thomas_Pegler
4 - Data Explorer
4 - Data Explorer

I managed to handle this myself by checking fields against the base schema for each base and only getting the fields that weren't lookups.

Get the table schema from

axios.get('https://api.airtable.com/v0/meta/bases/${baseId}/tables')

With this  you'll get all of the information for each table within the base, including all fields, their type , id and name. With the type, you'll get multipleLookupValues, and just collect the name of all other fields and select only those on the select() method using the fields parameter.