filterByFormula column name with spaces


#1
base('Test Space Request 2016').select({
    view: "Main View",
    filterByFormula: "({Requester Name} = 'Mo Biegel')"
}).eachPage(function page(records, fetchNextPage) {

}, function done(error) {

});

For some reason this isn’t bringing up any data, any ideas why?

via CURL:
https://api.airtable.com/v0/appO7dvt1H3N3gLmB/Test%20Space%20Request%202016?filterByFormula=({Requester%20Name}="Mo%20Biegel")

Thanks!


#2

Not sure, but two things stood out:

  1. Is it possible that ‘Mo Biegel’ is not present in the “Main View” view? You specified that view in the JS example, but not the cURL example. Try removing the view parameter?

  2. The curly brackets or parentheses in your filterByFormula are not URL encoded. In my testing, that breaks the cURL request. Try https://api.airtable.com/v0/appO7dvt1H3N3gLmB/Test%20Space%20Request%202016?filterByFormula=({Requester%20Name}=“Mo%20Biegel”)

In my experience with the Airtable API (which is limited to PHP and cURL), I have to ensure that everything is properly URL encoded before I make a request.


#3
  1. Removed main view - didn’t resolve the issue
  2. That’s the thing - CURL is working fine, the official airtable javascript client is what is causing the trouble :grin:

#4

Gotcha. I did a quick test using the official Airtable JS library on GitHub and it handled spaces just fine. I’m guessing that you simply removed the code from your example above that actually does something with the results, but does the following work?

base('Test Space Request 2016').select({
    filterByFormula: "({Requester Name} = 'Mo Biegel')"
}).eachPage(function page(records, fetchNextPage) {
    records.forEach(function(record) {
        console.log('Retrieved ', record.get('Name space'));
        alert('Retrieved ', record.get('Name space'));
    });

    fetchNextPage();
}, function done(error) {
    console.log(error);
});

#5

That worked!!! Thanks man!

Not sure if I should open another question about the following: what if I want to filter by date?
filterByFormula: "({Prep Start Date} = '2016-10-24')"

That isn’t bringing anything up, there is a row that matches…


#6

Try the filterByFormula:

IS_SAME({Prep Start Date},TODAY(),'day')

You could also do:

DATETIME_DIFF({Prep Start Date},TODAY(),'days')=0

And (probably not last):

DATETIME_FORMAT({Prep Start Date}, 'YYYY-MM-DD') = "2016-11-01"

The complete reference for available Formulas is at


#7

IS_SAME worked - thanks Chester I really appreciate your help!