Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Aug 07, 2022 04:28 AM
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:
I tried to search with select by record names, but it didn’t work. Table structure:
Solved! Go to Solution.
Aug 08, 2022 05:33 AM
You have to match up record IDs with names after you get the data from the [Students] table.
Aug 07, 2022 05:47 PM
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.
Aug 07, 2022 07:04 PM
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
Aug 07, 2022 09:04 PM
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.
Aug 07, 2022 09:29 PM
This is a question… How I should do it? I get only students ids and can’t get it’s names
Aug 08, 2022 05:33 AM
You have to match up record IDs with names after you get the data from the [Students] table.
Aug 08, 2022 08:24 AM
Oh… It’s an adjacent object! I thought these were different structures, but the names are the same) Thank you)