Jan 21, 2021 11:47 AM
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.
Solved! Go to Solution.
Jan 22, 2021 09:23 AM
I already gave you how to filter records. The only difference you’d make is changing records
to rootTableDat.records
Jan 21, 2021 05:32 PM
Is that the exact name of the field?
Jan 22, 2021 08:03 AM
The field I want to search is called ‘Name’. I thought ‘fields’ searched all columns/fields???
Jan 22, 2021 08:09 AM
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")
Jan 22, 2021 08:35 AM
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?
Jan 22, 2021 09:23 AM
I already gave you how to filter records. The only difference you’d make is changing records
to rootTableDat.records