Hi all, I have tried for over 2 hours to get this to work, but can’t seem to.
I am trying to update a barcode primary key field. but the closest I got was this error message:
Type ‘string’ is not assignable to type ‘{ text: string; type?: string; }’....
I have a table called “Settings” and a field called “Next Number” and a field called “Format”
Next Number is 101000
Format is ‘TRnnnnnn’
How do I write a script that when I press run, it updates all blank Primary Keys on my view, with the new number...
oh i figured it out:
//Get the next Number from settings
let tableSetting = base.getTable(“Sequence”);
let queryResultSetting = await tableSetting.selectRecordsAsync();
let recordSetting = queryResultSetting.getRecord(queryResultSetting.recordIds[0]...
oh I figured it out, you have to put it inside an extra object with { } and use the text: property. so that you can update barcode fields.
await table.updateRecordAsync(record, {
'Barcode field Name': { text: prefix + nextnumber, },
...
Thanks Scott and Greg, your solution was what I had already thought of on my own before I came here. But I actually want to automate this. I have tried automating this myself but failed because it would not let me update my primary key field. Do...