Resources »

Solutions Hub »

Automations »

Sum or multiply an array of numbers

You can use array_sum() and [ reduce](/docs/scripting/filters/#reduce) to calculate the sum or product of an array of numbers and reduce the output to that single result.
  • start:
      set:
        numbers@csv: 1, 9, 2002, 4, 27, 2001
      return:
        sum@int: {{array_sum(numbers)}}
        product@int: {{numbers|reduce((carry,n) => carry * n, 1)}}
  • __return:
      sum: 4044
      product: 3893833944