I can’t for the life of me to get this script to work. I’m trying to do a vlookup across two tables.
“In Contract” table is the one that I’m trying use the information from “Movie/Episode Title” Column and find that same title in the “Episode/Movie Title” in the “All Assets” table and then grab the info from the “Program/ Asset ID” column and paste that into the “Asset ID” column on the “In Contract” table.
let mainTable = base.getTable(“In Contract”);
let mainTableRecords = await mainTable.selectRecordsAsync({fields:[“Episode/Movie Title”]});
let lookupTable = base.getTable(“All Assets”)
let lookupRangeRecords = await lookupTable.selectRecordsAsync({fields:[“Movie/Episode Title”,“Program/ Asset ID”]});
for (let record of mainTableRecords.records) {
let lookupvalue = record.getCellValue(“Episode/Movie Title”);
for (let reangeRecord of lookupRangeRecords.records) {
if (rangeRecord.getCellValue("Movie/Episode Title") === lookupValue). {
let returnValue = rangeRecord.getCellValue("Program/ Asset ID");
await mainTable.updateRecordsAsync(record, {
"Asset ID": returnValue
});
}
}
}
Here is the error I’m getting…
ERROR
SyntaxError: Unexpected token ‘.’
at Function
on line 1
at l on line 1
on line 1
at r on line 1
at s on line 1
on line 1
at Promise
on line 1
at l on line 1
on line 1
at r on line 1
at s on line 1
on line 1
at Promise
on line 1
at l on line 1
on line 1
at r on line 1
at s on line 1
on line 1
at Promise
on line 1
at handle on line 1
on line 1
I’m sure it is something really dumb that I’m missing.