Hi
I am rather new to coding and was rather proud of myself to get the following script working. I just wanted to list all the field names, types and descriptions, for each table in my base, in another table called “Field list”.
It worked on my test base, but when I run in on the base I wanted to use it with, it only writes approx 14 records. Oddly in the console, it lists all the fields and descriptions.
I tried using await - but get the above error (I think this is something to do with trying to write too many records in one go? I am sure my script is bad and also suspect this is a simple error. Any advice appreciated.
Script below
Thanks,
Andrew
const tables = [“Transactions”, “Suppliers”, “Master Budget”, “Primary budget lines”, “Secondary budget lines”];
tables.forEach(function (table_name) {
console.log('Looping through ',table_name);
let input_table = base.getTable(table_name);
for (let field of input_table.fields) {
let name = field.name
let description = field.description
let field_type = field.type
console.log(`Field "${field.name}" has description "${field.description}" in table "${table_name}".`);
await output_table.createRecordsAsync([
{
fields: {
'Field name': name,
'Field description': description,
'Table name': table_name,
'Field type': field_type,
},
},
])
}
});
output.text(‘Done!’);