Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Running total from another table

Topic Labels: Extensions
317 1
cancel
Showing results for 
Search instead for 
Did you mean: 

I’m using Running total script, it’s works fine within the same table.

But when I enter another table in first line, stop working!

This is my script.

// change these names to pick a view:

let table = base.getTable(‘Purchases’);

let inputConfig = input.config();

let view = table.getView(${inputConfig["Ad Set"]});

let result = await view.selectRecordsAsync();

let runningTotal = 0;

for (let record of result.records) {

// change the field names here to adapt this script to your base

runningTotal += record.getCellValue('Price');

await table.updateRecordAsync(record, {

    'Revenue': runningTotal,

});

}

1 Reply 1

Welcome to the community, @eSilkRoad_Academy! :grinning_face_with_big_eyes: Changing the table alone isn’t enough. The third line is looking for a specific view, with that view’s name coming from the data passed from an earlier step in the automation via the “Ad Set” input variable. If that value doesn’t match an actual view name in the table retrieved by the first line, the script will fail.