For some reason, all of records are being updated when I believe my “if” statement should only have the record the form chose to be updated. What am I doing wrong here?
let table = base.getTable(‘Material Log’);
let view = table.getView(‘Joe Inventory Core’);
let inputConfig = input.config();
let coreName = inputConfig.coreName;
let coreNameString = coreName.toString();
let coreNumAdded = inputConfig.numAdded;
let fieldValue = await view.selectRecordsAsync( {fields: [‘Current Core Inventory’,‘Winstore Code’]});
let currentCoreInventory = 0;
let coreName2 = ‘’;
for (let record of fieldValue.records)
{
coreName2 = record.getCellValue(‘Winstore Code’);
if(coreName2 = coreNameString)
{
currentCoreInventory = record.getCellValue(‘Current Core Inventory’);
await table.updateRecordAsync(record, {‘Current Core Inventory’: currentCoreInventory + coreNumAdded,});
}
}