Help

Running total from another table

Topic Labels: Extensions
795 1
cancel
Showing results for 
Search instead for 
Did you mean: 
eSilkRoad_Acade
4 - Data Explorer
4 - Data Explorer

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.