May 11, 2023 08:06 AM - edited May 16, 2023 08:12 AM
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
Solved! Go to Solution.
May 18, 2023 07:08 AM - edited May 18, 2023 07:17 AM
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.
May 18, 2023 07:08 AM - edited May 18, 2023 07:17 AM
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.