Help

Re: What is the first parameter for the find function

2910 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Ethan_Richardso
4 - Data Explorer
4 - Data Explorer

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

6 Replies 6
HHelb
5 - Automation Enthusiast
5 - Automation Enthusiast

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.

Ethan_Richardso
4 - Data Explorer
4 - Data Explorer

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);
    }
});
HHelb
5 - Automation Enthusiast
5 - Automation Enthusiast

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.

Great, thank you very much, I am new to airtable.

Thank you for your attention and patience.

Many Thanks

Ethan

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.

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.