You are viewing limited content. For full access, please sign in.

Question

Question

Javascript adding issues

asked on August 16, 2017

I'm trying to get all the fields in my PO form to add up to a grand total, however, the tax and shipping boxes appear to be multiplying and I noticed the multiplication increases with each new row I add above. How can I fix this so it adds normally?

Screen Shot 2017-08-16 at 3.00.16 PM.png
Screen Shot 2017-08-16 at 3.00.05 PM.png
0 0

Replies

replied on August 16, 2017

I would suggest using functions instead of javascript to accomplish this as it will be a little easier to maintain and troubleshoot.

For your "Total" column, use a function like this:

=PRODUCT(INDEX(table.quantity,ROW()),INDEX(table.price,ROW()))

Just replace "table.quality" and "table.price" with the appropriate variable references for your table columns.

That will calculate the total for you without the need for javascript.

Then, for the "grand total" do something like

=SUM(table.total,shipping,tax)

Which will sum the "total" column, plus the "shipping" and "tax" fields. Once again, just replace the variables with the ones from your form.

The formula section makes it pretty easy since the ">" opens up a list of all the form variables, including table columns.

1 0
replied on August 17, 2017

Mike,

 

Can you post your Variable Name of the Table itself, the Quantity Field, and the Unit Price?  Also will you post the formula you used in the Total Price Calculation?

 

Thanks

1 0
replied on August 17, 2017

The tax and shipping are adding appropriately now, however, there is a new problem, the quantity and unit price is not producing the correct total price in the table. 

Screen Shot 2017-08-17 at 8.46.14 AM.png
0 0
replied on August 17, 2017 Show version history

As Evan said, the variable names and actual formula would help. Based on your screenshot, it looks like it is not multiplying the Quanity and Unit Price.

Just to cover all our bases, the Quantity field is a Number type and not a Single Line, correct?

0 0
replied on August 17, 2017

It was single line, I changed it to number and it is working now. Looks like the formula was ignoring it because as a text field.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.