Help

Sum Total in Script Editor

Topic Labels: Automations
3821 5
cancel
Showing results for 
Search instead for 
Did you mean: 
Ryan_Mizak
4 - Data Explorer
4 - Data Explorer

Trying to set up automation in script editor to show sum total from a table. This needs to only be sent out when new item is added to the table and an email sent out every 7 days

5 Replies 5

Hi @Ryan_Mizak,
At this time Automations cannot perform calculations. You can run a script to gather data and perform a calculation, this will need to store the result in your base if you wish to send it out in another automation or subsequent action.

If you already have a formula field in your base making this calculation you can send it in an email.

What issues are you running into?

My apologies, I am trying to figure out the correct script to run a sum calculation, but have gotten stuck.

var array = [1, 2, 3, 4, 5];

// Getting sum of numbers
var sum = array.reduce(function(a, b){
    return a + b;
}, 0);

console.log(sum); // Prints: 15
Ryan_Mizak
4 - Data Explorer
4 - Data Explorer

sorry im new to this, will this be able to find a sum of a total in a row on a table?

No, this is a javescript example you can use to show the sum of a column (field) of numbers. You would need to expand on your script to then add that to a record.

To Sum a Row (record) I would not use a script, I would use a formula field and SUM({number 1},{number 2})

What is it that you are trying to accomplish?