As the title says. How would this be written differently to avoid this error? My test environment only had 10 records, tonight was its first scheduled automation run and it grabbed 95 records for this process.
// After Club Automations
let table = base.getTable(“Children”)
let view = table.getView(“Present”);
let query = await view.selectRecordsAsync ({
fields:[“Pts this week”, “Spent Today”, “Total Spent”, “Points”, “Attendance”, “Last Club”],
sorts: [
{field: “Pts this week”},
]
});
let totes = 0;
let today = new Date()
for (let record of query.records){
// Multiply 'Pts this week" by 10, add to ‘Points’, Subtract 'Spent Today, write new total to “Points” field
totes = 10 * Number(record.getCellValueAsString("Pts this week"));
totes = totes + record.getCellValue("Points") - record.getCellValue("Spent Today");
await table.updateRecordAsync(record, {"Points": totes});
// Add ‘Spent today’ to ‘Total Spent’ and clear ‘Spent today value’
totes = record.getCellValue("Spent Today") + record.getCellValue("Total Spent");
await table.updateRecordAsync(record, {"Total Spent": totes});
await table.updateRecordAsync(record, {"Spent Today": null});
// Add one to Attendance Column
totes = record.getCellValue("Attendance") +1
await table.updateRecordAsync(record, {"Attendance": totes});
// Update Last Club with Today’s Date
await table.updateRecordAsync(record, {"Last Club": today});
// Clear Pts this week field
await table.updateRecordAsync(record, {"Pts this week": null});
}
Thanks in Advance!