Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: filterByFormula returns nothing (node.js) but results everywhere else

Solved
Jump to Solution
557 0
cancel
Showing results for 
Search instead for 
Did you mean: 
andy_m
5 - Automation Enthusiast
5 - Automation Enthusiast

This forum has been incredibly helpful, so I thought I'd keep asking questions. 
Next up is why filterByFormula doesn't seem to work in my node app. However, the formula works in the Airtable UI and when used in an HTTP request via the API. 

 

const base = new Airtable({ apiKey: 'xxxxxx' }).base('yyyyy');

const matchingRecords = [];
await base('tblbfJeKQo52GnLWD')
    .select({
      filterByFormula: '{project_id}="3986271"'
    }).eachPage(
      (pageRecords, fetchNextPage) => {
        pageRecords.forEach(record => {
          
          console.log(record);
          matchingRecords.push(record);
        });
        fetchNextPage();
      },
      err => {
        if (err) {
          console.error(err);
          return;
        }
      }
    );
  console.log(matchingRecords);

 

The above returns `matchingRecords` as an empty array. 

However, 

 

https://api.airtable.com/v0/app49uIs2F0Ca2ES3/tblbfJeKQo52GnLWD?filterByFormula={project_id}='3986271'

 

returns a result as expected.

The formula also returns true in the AirTable itself..

andy_m_0-1712109723940.png

 

What am I missing? 😕 

 

1 Solution

Accepted Solutions
dilipborad
9 - Sun
9 - Sun

Hello @andy_m 

Instead of use 

{project_id}="3986271"

Use this approach.

AND({project_id}='your project id')

👍

See Solution in Thread

2 Replies 2
dilipborad
9 - Sun
9 - Sun

Hello @andy_m 

Instead of use 

{project_id}="3986271"

Use this approach.

AND({project_id}='your project id')

👍

andy_m
5 - Automation Enthusiast
5 - Automation Enthusiast

thanks!