selectRecordsAsync search on calculated field

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.

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

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.