Help

Re: selectRecordsAsync search on calculated field

Solved
Jump to Solution
738 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Robert_Kamarows
5 - Automation Enthusiast
5 - Automation Enthusiast

I have the following code that is looking for the value of a calculated field. But I’m getting an Error: no field matching …

let rootTableDat = await rootTable.selectRecordsAsync(
{
fields: [“Zeiss Planar 80mm 2.8-Prontor CB”]
}
);

Should this work? Is there a preferred way of doing this?
Thanks.

1 Solution

Accepted Solutions

I already gave you how to filter records. The only difference you’d make is changing records to rootTableDat.records

See Solution in Thread

5 Replies 5

Is that the exact name of the field?

The field I want to search is called ‘Name’. I thought ‘fields’ searched all columns/fields???

I don’t know what that is supposed to mean.

The “fields” key in the object passed into selectRecordsAsync() asks: “Which fields should come included in the returning records list”. If your field is called “Name”, then you should have put fields: ["Name"].

If you’re trying to find the record where Name = “Zeiss Planar 80mm 2.8-Prontor CB”, you can do that by filtering a list of records, which would look something like this: records.filter(x=> x.getCellValueAsString("Name") === "Zeiss Planar 80mm 2.8-Prontor CB")

Here’s the entire code:

console.log(Database = ', ${base.name}!);
let rootTable = base.getTable(“LensShutter”);
console.log('Root Table = ', rootTable.name);
let linkedTable = base.getTable(“Shutter”);
console.log('Linked Table = ', linkedTable.name);
let view = rootTable.getView(“Grid view”)

let rootTableDat = await rootTable.selectRecordsAsync(
{
fields: [“Name”]
}
);

console.log(rootTableDat)

How do I filter the records?

I already gave you how to filter records. The only difference you’d make is changing records to rootTableDat.records