Copying records to another table with dissimilar columns

Hi there :slight_smile:

I want to copy certain fields of a record to another table.

Example:
table 1 has 3 fields with names: 1,2,3
table 2 has 4 fields with names: 1,3,4,5

When the script is run, all records of table 1 should be copied to table 2 into fields 1 and 3 (leaving fields 4 and 5 empty). Could you give me some direction as to what should go into the bold section?

What I have so far:

let table1 = base.getTable(‘Table 1’);
let table2 = base.getTable(‘Table 2’);
let copyQuery = await table1.selectRecordsAsync();
for (let record of copyQuery.records){
table2.createRecordsAsync([
{
//what should be here
}
]);
};

Follow this thread:

1 Like