Help

Need help on duplicating field row between tables

Topic Labels: Scripting extentions
1976 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Vincent_Chan
4 - Data Explorer
4 - Data Explorer

I would like to know how to copy a column “Items” from one table to another table.

Both table have the same naming “Items”

Table Name:
DB_Checklist
Daily_Closing_Checklist

View Name:
DB_Checklist > Closing

Field Name:
DB_Checklist > Items
Daily_Closing_Checklist > Items

I want to copy one of the row of data from DB_Checklist/Closing/Items to Daily_Closing_Checklist/AllEntry.

Can anyone show me how to code this?

let checklist = base.getTable("DB_Checklist");
let checklistView = checklist.getView("Closing");

let dailyClosingChecklist = base.getTable("Daily_Closing_Checklist");

Daily_Closing_Checklist

DB_Checklist

I only know this much, want to learn more on how to make my table more automate.

3 Replies 3

What are the types of these two fields? Also, define “copy” - do you want to create new records or append the said row to existing records?

//this loads the data
const source = await base.getTable("DB_Checklist").getView("Closing").selectRecordsAsync({fields:["Items"]});

//this preps an array as if we're creating new records in the other table
const toCreate = source.map( rec => rec={name:rec.name,fields:{"Items":rec.getCellValue("Items")}}
);

while(toCreate.length) 
    await base.getTable("Daily_Closing_Checklist")
        .createRecordsAsync(toCreate.splice(0,50))

Typing this from memory, probably messed up a closing parantheses somewhere, but that’s the gist of the syntax. It all comes down to what exactly do you want to do.

i might be totally missing the mark here. but it looks like you have the items linked to the closing checklist so you should be ably to use a lookup field? also i think airtable is meant to work a little bit different than this. again. i may be TOTALLY elementarizing your request. someone feel free to tell me im dumb but i think thats the answer youre looking for.

I agree, it seems like they want to treat the two tables as spreadsheets.