Oct 14, 2016 02:22 AM
Hi,
Does anyone know what the first parameter is for the find function.
Here is my example i found from the api docs
base(‘Clothes’).find(‘recHCaksbNTrZKM2g’, function(err, record) {
…
Many Thanks
Oct 14, 2016 03:09 AM
Hey,
You mean this one : recHCaksbNTrZKM2g ?
It is the Id given to your record.
To retrieve your record, the api needs its ID. I don’t think you can retrieve a record without it yet.
Oct 14, 2016 03:24 AM
Ok, but how do would I get the ID of the record, i have seen that there a list records process (see below) but how do I get the I from this ?
var Airtable = require('airtable');
var base = new Airtable({ apiKey: 'YOUR_API_KEY' }).base('app1mjrfgjv0RUiFT');
base('Clothes').select({
// Selecting the first 3 records in All Clothes :
maxRecords: 3,
view: "All Clothes "
}).eachPage(function page(records, fetchNextPage) {
// This function (`page`) will get called for each page of records.
records.forEach(function(record) {
console.log('Retrieved ', record.get('Name'));
});
// To fetch the next page of records, call `fetchNextPage`.
// If there are more records, `page` will get called again.
// If there are no more records, `done` will get called.
fetchNextPage();
}, function done(error) {
if (error) {
console.log(error);
}
});
Oct 14, 2016 04:23 AM
When you get to the record inside your forEach loop, you can get it like this:
record.id
If you want to see it, try console.log(record.id)
after the line records.forEach(function(record) {
Hope this will help you.
Oct 14, 2016 06:48 AM
Great, thank you very much, I am new to airtable.
Thank you for your attention and patience.
Many Thanks
Ethan
Mar 02, 2018 04:27 PM
Is there a way to see the record.id without iterating through all of my records? I have a separate data source that will be referencing a specific row from my data, so I’d love to be able to see the list of records/ids to be able to transpose them to the other system.
Mar 02, 2018 07:49 PM
The easiest way is a non-programmatic solution: Add a formula field to your base with the formula defined as RECORD_ID()
and modify your external data source to store a copy of that field…
Otherwise, you’ll have to search for each record based on its primary field (assuming that’s a unique value) or, alas, iterate through all of your records.