Calculating Quantities in Order form

May 22, 2019

Copy link to clipboard

Copied

This is a really simple question but it isn't working well for me.

I have an order form with quantities and amounts.

I have a field called Quantity.0 and a field called Amount.0

I want whatever quantity is in the "quantity" field to calculate into the amount field.

However after creating simplified and custom, it keeps increasing my amount field as I go through my spreadsheet.

If someone wants to decrease their quantity on the form, I would like it to recalculate the amount off the new quantity.

Then at the bottom of my form, I have a total field which I want to calculate all the Amounts. I used the sum+ and reordered the fields but that isn't adding correctly.

Any help is requested.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

82

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Calculating Quantities in Order form

May 22, 2019

Copy link to clipboard

Copied

This is a really simple question but it isn't working well for me.

I have an order form with quantities and amounts.

I have a field called Quantity.0 and a field called Amount.0

I want whatever quantity is in the "quantity" field to calculate into the amount field.

However after creating simplified and custom, it keeps increasing my amount field as I go through my spreadsheet.

If someone wants to decrease their quantity on the form, I would like it to recalculate the amount off the new quantity.

Then at the bottom of my form, I have a total field which I want to calculate all the Amounts. I used the sum+ and reordered the fields but that isn't adding correctly.

Any help is requested.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

83

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 22, 2019 0
May 22, 2019

Copy link to clipboard

Copied

It is not clear what the exact script is that you are using. It would be helpful to post the script and possibly link to a copy of the form you are using the script in. Be sure to include all the scripts in the form.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 22, 2019 0
May 22, 2019

Copy link to clipboard

Copied

Calculation.jpg

The script I current have in the amount boxes: event.value = ( this.getField("Amount.7").value * this.getField("Quantity.7").value )

The total field, I just used the Value is the sum+ of the following fields.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 22, 2019 0
May 22, 2019

Copy link to clipboard

Copied

You can't use a field's own value in its calculation. That's circular logic.

You need to create another column for the price of each item.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 22, 2019 0
May 22, 2019

Copy link to clipboard

Copied

Ok. The pricing varies so I will just remove calculations. The employees can calculate on their own.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 22, 2019 0
May 22, 2019

Copy link to clipboard

Copied

I guess I don't understand what you're trying to achieve... Isn't Quantity and Amount the same thing?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 22, 2019 0
May 22, 2019

Copy link to clipboard

Copied

No. I added a new column for Item amount. So that way the formula should work and calculate the quantity * the item amount = total amount.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 22, 2019 0
try67 LATEST
May 22, 2019

Copy link to clipboard

Copied

Ah, I see. The amount is actually the price. Well, you need to define the price-per-item somewhere. You can't use the same column for both things.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 22, 2019 0