Skip to main content
Answer

How to Perform Mathematical Operations

  • October 22, 2024
  • 7 replies
  • 86 views

i am trying to sum all values showing up under line items output but it's not coming up as a single value output

Best answer by Troy Tessalone

@Shine 

Looks like Formatter does not like an array of numbers.

So you will have to flatten the array.

Zap action: Formatter > Utilities > Line Items to Text

Set them to be comma separated.

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

7 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • October 22, 2024

Hi @Shine 

Help us have more info by posting screenshots with how your Zap steps are outlined and configured in EDIT mode so we can see the field mappings.


  • Author
  • Beginner
  • October 23, 2024

I have attached the requested screenshots. In the Output (screenshot 5), I'm trying to have it be the sum of all the values appearing there instead of it showing as the individual line items with commas.

 

thanks in advance


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • October 23, 2024

@Shine 

Try this Zap action: Formatter > Numbers > Perform Math Operation (Add)


  • Author
  • Beginner
  • October 24, 2024

so I added a step to remove the comma's from the line items output, then to add the numbers but i'm still getting an Invalid Syntax error, Only numeric values are allowed. Im thinking it's gettting the "-”(negative sign) as a non-numerical value. Any other work-around you can think of?


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • Answer
  • October 24, 2024

@Shine 

Looks like Formatter does not like an array of numbers.

So you will have to flatten the array.

Zap action: Formatter > Utilities > Line Items to Text

Set them to be comma separated.


  • Author
  • Beginner
  • October 25, 2024

I did that as an additional step prior to Adding and it works already. Thanks!


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • October 28, 2024

That’s amazing @Shine! A huge thanks to Troy for pointing you in the right direction!

If you have any other questions, please don’t hesitate to reach out to the Community. We’re always happy to help! 🤗