I have a scripting block that, for each record R in a given table, pulls a bunch of data from a different table, calculates a number N, and updates a field F for that R.
The problem is some records are updated and others are not.
I know that records are being pulled correctly as I print N for every R and it all calculates correctly. I know that the update code works as some records will update.
One interesting thing to note: the updated R I think are all old and the non-updating ones were recently added. I thought this might have been a Free/Plus/Pro account issue as only Pro supports Apps and maybe older records were grandfathered but I have paid for Pro and still no go. Is this a permissions issue?
By the way, are apps the same as scripting blocks or different?
Code in question below:
let table = base.getTable(BaseSpecificNames.cashFlowTable);
let view = table.getView(BaseSpecificNames.sortedView);
let query = await view.selectRecordsAsync();
let filtered = query.records;
let dtable = base.getTable(BaseSpecificNames.dealsTable);
let dquery = await dtable.selectRecordsAsync();
for(let record of dquery.records)
{
let dealnum = record.getCellValue(BaseSpecificNames.dealsIDField);
let dealname = record.getCellValue(BaseSpecificNames.dealNameField);
filtered = query.records.filter(record => {
return (record.getCellValue(BaseSpecificNames.dealID) == dealnum);
});
let IRR = calcIRR(dealnum);
output.text(dealnum + ":\t" + dealname + ":\t" + IRR);
//THIS IS THE UPDATE IN QUESTION
dtable.updateRecordAsync(record, {“IRR”: IRR});
}