Skip to main content
Solved

selectRecordsAsync search on calculated field

  • January 21, 2021
  • 5 replies
  • 41 views

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.

Best answer by Kamille_Parks11

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

5 replies

Kamille_Parks11
Forum|alt.badge.img+27

Is that the exact name of the field?


  • Author
  • New Participant
  • 4 replies
  • January 22, 2021

Is that the exact name of the field?


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


Kamille_Parks11
Forum|alt.badge.img+27

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")


  • Author
  • New Participant
  • 4 replies
  • January 22, 2021

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?


Kamille_Parks11
Forum|alt.badge.img+27
  • Brainy
  • 2679 replies
  • Answer
  • January 22, 2021

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