
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 20, 2021 10:28 AM
I am attempting to create a simple script which will count the number of entries in a linked lookup field. My plan was to invoke .selectRecordAsync() on the table of interest to pull the records and count the number of entries for a given record in that field.
I’ve run into an issue early on with this script: the selectRecordAsync call appears to only be returning the name field and Id for the records, but no other data. My code is below.
let vendorTable=base.getTable("Vendors");
let quoteField=base.getTable("Vendors").getField("Quoted Parts")
let records= await vendorTable.selectRecordsAsync()
console.log(quoteField)
console.log(records)
let exampleValue=records[0].getCellValue(quoteField)
console.log(exampleValue)
I’m getting the following responses in the console.
My table is structured as follows:
The only issue I can think of off hand is that all of the fields (aside from name) are linked or lookup values.
What am I missing here?
Solved! Go to Solution.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 20, 2021 10:49 AM
What is returned by calling selectRecordsAsync
on a table instance is an instance of another class known as a RecordQueryResult
. It’s not a direct array of records that can be accessed as you’re trying to do in this line:
let exampleValue=records[0].getCellValue(quoteField)
A RecordQueryResult
instance contains three properties:
- recordIds - a string array of all record IDs from the table
- records - an array of
Record
instances representing all records in the table - getRecord - a method that can be used to retrieve a single record by its ID
On a side note, you don’t need to use the getField
method on a table to retrieve a field to use as part of a getCellValue
call. You can just pass the string name of the field.
Using that info to access the first record from the records
array on that query, your code whould look like this:
let vendorTable = base.getTable("Vendors");
let query = await vendorTable.selectRecordsAsync()
let exampleValue = query.records[0].getCellValue("Quoted Parts")
console.log(exampleValue)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 20, 2021 10:49 AM
What is returned by calling selectRecordsAsync
on a table instance is an instance of another class known as a RecordQueryResult
. It’s not a direct array of records that can be accessed as you’re trying to do in this line:
let exampleValue=records[0].getCellValue(quoteField)
A RecordQueryResult
instance contains three properties:
- recordIds - a string array of all record IDs from the table
- records - an array of
Record
instances representing all records in the table - getRecord - a method that can be used to retrieve a single record by its ID
On a side note, you don’t need to use the getField
method on a table to retrieve a field to use as part of a getCellValue
call. You can just pass the string name of the field.
Using that info to access the first record from the records
array on that query, your code whould look like this:
let vendorTable = base.getTable("Vendors");
let query = await vendorTable.selectRecordsAsync()
let exampleValue = query.records[0].getCellValue("Quoted Parts")
console.log(exampleValue)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 20, 2021 11:22 AM
Thanks @Justin_Barrett . This was exactly the issue. Much appreciated
