Skip to main content

Copying records to another table with dissimilar columns

  • December 2, 2020
  • 1 reply
  • 9 views

Hi there :slightly_smiling_face:

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
}
]);
};

1 reply

Kamille_Parks11
Forum|alt.badge.img+27

Follow this thread: