Help

How to get field names by one request?

Topic Labels: Sync
Solved
Jump to Solution
2903 6
cancel
Showing results for 
Search instead for 
Did you mean: 
heldinshon
4 - Data Explorer
4 - Data Explorer

Hi, I am trying to get field names by request in table.

airtable.table('Classes').select({
  filterByFormula: `SEARCH(RECORD_ID(), "recr0DOF3YWjN9wAH,recwrHZ9zBIYFiU07,rectGHWsZVmkeRwGh,recJKCgej9ihrL2pK") != ""`,
}).firstPage().then((data) => {
    data.forEach((data) => {
       console.log(data);
    });
 });

In Students I get field ID’s, but I want to get it’s names by one request:
Screenshot 2022-08-07 at 7.23.02 PM

I tried to search with select by record names, but it didn’t work. Table structure:
Screenshot 2022-08-07 at 7.27.44 PM

1 Solution

Accepted Solutions

You have to match up record IDs with names after you get the data from the [Students] table.

See Solution in Thread

6 Replies 6

Welcome to the Airtable community!

It looks like you are using the REST API. Are you trying to get field names like {Students} or {Name}? Or are you trying to get field values like [Joe, Mike, Jenny]?

In the REST API, when returning the value of a linked record field, you get an array of record IDs, as shown in your screen capture. You cannot directly get the student names. You can go to your [Students] table and query that table for the records with the returned record IDs.

If you know the name of the class and want all the students, you could also try getting the data by querying the [Students] table for students in the given class.

I don’t wanna query all table. I have class name and I want to get students names like [Joe, Mike, Jenny] by class name. Can I get it in 2 requests? First is students linked ids by {Name} and then second get {Students} names by {Students} ids from first request?

I am using this lib GitHub - Airtable/airtable.js: Airtable javascript client

Yes, you can get all the info in two requests (assuming that you need only one request per table, and do not need to deal with the max page size of 100 records). You may need to do a bit of processing after you get the data to put it into the format you want to use.

heldinshon
4 - Data Explorer
4 - Data Explorer

This is a question… How I should do it? I get only students ids and can’t get it’s names

You have to match up record IDs with names after you get the data from the [Students] table.

heldinshon
4 - Data Explorer
4 - Data Explorer

Oh… It’s an adjacent object! I thought these were different structures, but the names are the same) Thank you)