Hi,
I have been trying to iterate only a few itens in a table, with no success. Apparently the filter() method does not work as expected in the example below. I would expect both codes worked the same, but they don't.
let table = base.getTable("My table");
let query = await table.selectRecordsAsync({fields: [ 'Total' ]});
console.log('TEST 1 - uses filter() ');
let query = await table.selectRecordsAsync({fields: [ 'Total' ]});
for (let record of query.records.filter((each) => { 0 == each.getCellValue('Total') } )) {
console.log('Found a zero!');
}
console.log('TEST 2 - without filter() ');
for (let record of query.records) {
if ( 0 == record.getCellValue('Total') ) console.log('Found a zero!');
}
My table has 4 records, with values 0, 1, 0, 0 for 'Total'. This is the output I get:
TEST 1 - uses filter()
TEST 2 - without filter()
Found a zero!
Found a zero!
Found a zero!
Any thoughts?