Help

The Community will be undergoing maintenance on Friday January 10 at 2:00pm - Saturday January 11 at 2:00pm EST, and will be "read-only." For assistance during this time, please visit our Help Center.

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

Topic Labels: API
Solved
Jump to Solution
740 2
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!