Skip to main content

I would like to find records whose ID field match a given value, playlistId, in a specific table I defined as playlistsRecords. In other words, I want to find matches in a field, get their record IDs, and if there are no matches to tell me that there are no matches. I've tried "playlistsRecords.includes(playlistId)" without success and suspect I need to rely something like the following:

 

base('Playlists').find(playlistId, function(err, record) { if (err) { console.error(err); return; } console.log('Retrieved', record.id); });

 

Any pointers? Past experience?

 

I beieve I figure it out myself, but more elegant solutions are welcome. 

Find my solution below:

 

var numberOfMatches = 0 for (var r = 0; r < Records.length; r++) {if(playlistId == playlistsRecords[r].getCellValue(idField)) { //If a given record's ID field matches the playlist ID numberOfMatches => numberOfMatches + 1} } if(numberOfMatches < 1) { console.log('No matches, created new curator record in Airtable') }

 

This solution relies on a variable, numberOfMatches, that updates for every record match.