
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Apr 01, 2017 12:22 PM
Hello!
I’m trying to find a record based on the value of a particular field. I’m using filterByFormula with select, and I think my syntax is wonky. This should be the easiest thing in the world with a DB. What am I doing wrong?
Thanks in advance for your help –
Cindy
base(‘New Playlists’).select({
filterByFormula: ‘ID = MyFunIDValue’,
}).eachPage(function page(records, fetchNextPage) {
records.forEach(function(record) {
console.log(‘Retrieved this playist record’, record.get(‘ID’));
});
}, function done(error) {
});

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Apr 01, 2017 12:31 PM
Try
filterByFormula: '{ID} = "MyFunIDValue"'

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Apr 01, 2017 12:39 PM
Thank you so much! --Cindy

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Apr 01, 2017 12:41 PM
It worked! Thank you, Chester!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Nov 23, 2019 07:35 PM
Here is an example if you are passing in a variable. This uses the JS template literals syntax to pass in the variable to the string.
var ID = "Test"
// <set up your connection>
/* retrieve records from the base matching a name */
base('New Playlists').select({
filterByFormula: `{ID} = "${name}"`
}).eachPage(function page(records, fetchNextPage) {
records.forEach(function(record) {
console.log('Retrieved', record.get('ID'));
console.dir(record); // show full record JS object
});
fetchNextPage();
}, function done(err) {
if (err) { console.error(err); return; }
})
