Running total from another table

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,

});

}

Welcome to the community, @eSilkRoad_Academy! :smiley: 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.

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.