Help

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

Re: [API] Formula filter for linked records not returning any results

1743 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Michael_Cetrulo
5 - Automation Enthusiast
5 - Automation Enthusiast

I have the base https://airtable.com/shrk4QtqMfI5yJdYr with two tables: Posts and Categories; The Posts table has one column which is a link to Categories and another which is a lookup on Categories.

The data is as follows:

{
    "records": [
        {
            "id": "rec0Wx3tdBsuBjHrV",
            "fields": {
                "Name": "Post 1",
                "Categories": [
                    "rec7PDGo7c2GP9wu2"
                ],
                "Category names": [
                    "Category 1"
                ]
            },
            "createdTime": "2018-11-22T20:24:15.000Z"
        },
        {
            "id": "rec334VYelorur9Ix",
            "fields": {
                "Name": "Post 3"
            },
            "createdTime": "2018-11-22T20:24:15.000Z"
        },
        {
            "id": "recIJhElGuUrFdvVn",
            "fields": {
                "Name": "Post 2",
                "Categories": [
                    "rec7PDGo7c2GP9wu2",
                    "reccMvdKsHB36MN3A"
                ],
                "Category names": [
                    "Category 1",
                    "Category 2"
                ]
            },
            "createdTime": "2018-11-22T20:24:15.000Z"
        }
    ]
}

The following request returns only record rec0Wx3tdBsuBjHrV (it should return rec0Wx3tdBsuBjHrV and recIJhElGuUrFdvVn since both have “Category 1”):

https://api.airtable.com/v0/appLEqjgwtfud3r86/Posts?filterByFormula={Category names}='Category 1'

And this request returns no results at all:

https://api.airtable.com/v0/appLEqjgwtfud3r86/Posts?filterByFormula={Categories}='rec0Wx3tdBsuBjHrV'

Although it clearly should return at least one.

4 Replies 4
Neil_Devas
4 - Data Explorer
4 - Data Explorer

Has this been solved? I am having the same issue.

Hi,
From my understanding of the API you cannot retrieve linked records using filterByFormula. That is not the purpose of it. filterByFormula is used to sort/filter record data in the target table. So filtering by a field in another table isn’t going to work. You could, I suppose, filter by the linked column using the actual record IDs that is saved in the column but I have never tried that.

I work with the API extensively and have written a tutorial on how to get linked records using the API.
You can check it out and let me know if it helps.

It’s possible:

Dmitrii_N
5 - Automation Enthusiast
5 - Automation Enthusiast

if linked record does not allow to link multiply values search by formula is possible like that:
ARRAYJOIN({columnName}) = “requiredValue”

If multiply values are possible, I did not tried that but surch by substring wit a help of MID, LEFT, SEARCH may help