Help

Welcome to the Airtable Community! If you're new here, check out our Getting Started area to get the most out of your community experience.

filterByFormula column name with spaces

Topic Labels: API
4843 6
cancel
Showing results for 
Search instead for 
Did you mean: 
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!

6 Replies 6

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=({Reques...

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.

  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 :slightly_smiling_face:

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);
});

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…

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

Formula field reference

For an overview of formula fields, please refer to the Guide to Formula, Lookup, Count, and Rollup fields. Formulas may involve functions, numeric operations, logical operations, and text operation...

IS_SAME worked - thanks Chester I really appreciate your help!