Hello Community!
I have the below script that will create X number of records based on the Episode Count, but I would like to tweak it to auto-number those episodes each time. For instance, Show 1 has 5 episodes, then each episode record would be numbered 1, 2, 3, 4, 5
//Tables
let projects = base.getTable('Shows');
let episodes = base.getTable('Episodes');
//Record Input
let record = await input.recordAsync('Please select a project', projects);
//Record variables
let quantity = record.getCellValue('Ep Count');
let order = record.id;
//New record array
let recArray = [];
//Iterate by quantity
if(quantity > 1){
for(let i=0; i < quantity; i++){
//Push to the array
recArray.push({
fields: {
'Shows': [{id: order}],
}
});
}
//Create new records
await episodes.createRecordsAsync(recArray);
}
Any insight would be so incredible appreciated Thank you!