Aug 09, 2020 09:30 PM
Any idea why the math isn’t working in my script. I am expecting two numbers to be added together (2+20018 = 20020) but instead get 220018
let table = base.getTable(‘Project List’);
let queryResult = await table.selectRecordsAsync();
let record = queryResult.getRecord(queryResult.recordIds[0]);
console.log(record)
let year = record.getCellValue(‘Year Count’)
console.log(year)
let num = year+20018
await table.updateRecordAsync(record.id, {“Project #”: num})
Aug 10, 2020 06:27 AM
Wild guess - you’re concatenating at least one string plus a number and JavaScript is converting it all to a string.
Try using parseInt() on each value to ensure they are numbers.
Aug 10, 2020 08:27 AM
That worked (BTW I know nothing of JS, I am just learning from reading the API documentation).
Aug 10, 2020 10:32 AM
Now you now more than nothing. :winking_face: