Help

The filterByFormula only returns rows below the 100th

Topic Labels: API
1692 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Samantha_Faw
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi All,

This is a rather urgent request - otherwise I will need to migrate away from AirTable and to mySQL overnight so your help is welcome.

I am using a PHP library for airtable and I have a lookup method on an Email field using filterByFormula.
It works great and returns users by their email as long as these users are among the 100th first in the table.
Below that limit, they are not found.

What am I missing ?

thanks a lot

3 Replies 3
Giovanni_Briggs
6 - Interface Innovator
6 - Interface Innovator

The GET method returns at most 100 records at a time. You need to paginate through the responses in order to get all records that match your formula. Within a response, if there is an additional page of responses to fetch, you will see an offset parameter. You should use that offset to get the next page. The pseudo-code looks something like this:

# fetch a page of records from Airtable
results = airtable.get("base_id", "table_name", {"filterByFormula": "MY FILTLER"})

# get the offset parameter
offset = results['offset'];

# create an array to hold all results
all_results = results['records']

# while offset is not NULL,
# fetch the next page by providing the "offset" query parameter
while offset is not NULL:
    results = airtable.get("base_id", "table_name", {"offset": offset})
    offset = results['offset'];
    all_results.append(results['records'])

Hi, Giovani,

Thanks for your answer but that’s not the problem

I do the following search (see in Postman)

Screenshot 2019-03-28 at 21.51.25.png

For an email before the 100th item in the table it always work, for an email below, it returns no records even though the email exists in the table

Thanks for your assistance

Samantha

Samantha_Faw
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi again

I found the error and it had nothing to do with a limit after 100 rows or anything

The data I had came from several excels files I had pasted in and the one for the range after 100 rows had spaces leading in the email field …

I added a trim and everything went fine

The thing is that leading spaces are not visible in the Airtable UI :winking_face: it took me a while to find the issue

Anyway, it is solved, thanks again