Mar 28, 2019 11:05 AM
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
Mar 28, 2019 12:05 PM
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'])
Mar 28, 2019 01:55 PM
Hi, Giovani,
Thanks for your answer but that’s not the problem
I do the following search (see in Postman)
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
Mar 28, 2019 02:49 PM
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