Hi all,
I came up with the following design for the internal BI system.
The first table is used to store the payments. (Payments table)

I also need to calculate the monthly sales statistics for each sales representative along with their quota (a predefined value that differed from month to month and added manually each time)
For that purpose, I have an additional table. (AM table)

The combination of (sales_rep, month, year) creates the unique id for the AM table and the linkage between two tables works very smoothly.
However, I believe there is room for improvement since I have to Link unique-id-am field to AM Quota manually every time.
I just drag the cell to AM Quota as you usually do when copying the column.
I want to automate this process and write a script that will perform this action for me in the add new row event.
I thought of doing something like that, but obviously AM Quota doesn’t allow me to do that due to the conflicts of type.
let table = base.getTable("Payments");
let query = await table.selectRecordsAsync();
for (let record of query.records) {
let am_id = record.getCellValue("unique-id-am")
let am_quota = record.getCellValue("AM Quota")
if (am_quota === null) {
await table.updateRecordAsync(record, {
'AM Quota': am_id
})
}
}
It seems there should be a search stage before pushing new values, but seeking advice from the community about that.
