I’m trying to simply copy one text field to another text field in a table with 10,000 records, in batches of 50 with the Scripting App.
What am I doing wrong in this block:
let table = base.getTable('TableName');
let query = await table.selectRecordsAsync();
let records = query.records;
const BATCH_SIZE = 50;
updateLotsOfRecords(records );
async function updateLotsOfRecords(records) {
let i = 0;
while (i < records.length) {
const recordBatch = records.slice(i, i + BATCH_SIZE);
for (let record of recordBatch ) {
let soureValue = record.getCellValue('SourceField');
await table.updateRecordAsync(record, {
'DestinationField': soureValue
});
}
i += BATCH_SIZE;
}
}