Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Calculating Sum of Multiple Fields & Ignoring Empty Fields

New Here ,
Sep 08, 2021 Sep 08, 2021

Hi, I'm creating a table which calculates the individual PRODUCT "Quantity" and "Price" for up to 10 items. Then the table has a "Total" (SUM of all PRODUCTS).

 

The issue I'm having is that some people will not use all of the "Quantity" and "Price" fields, and when they are left empty, the "Total" does not calculate unless all "Quantity" and "Price" are filled.

 

Right now I have a simple set up for calculating:

 

Field QP1 = Field Q1*Field P1 - this is what I use to calculate the Total of quantity and price for one item. This is continued from field QP1 to QP10

Field Total Value of Transfer = QP1+QP2+QP3+QP4+QP5+QP6+QP7+QP8+QP9+QP10 - this is where things get broken in the calculations I think, I just can't wrap my head around how to get these to work when some "QP" values are empty.

 

I'm not sure if this makes sense, but it would be helpful if someone has any idea of what I'm talking about.

TOPICS
Acrobat SDK and JavaScript , Mac , Windows
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 08, 2021 Sep 08, 2021

The fields calculation order is incorrect. You have to move the Total field to the end of the list for it to work correctly. The rest seems fine to me.

Translate
Community Expert ,
Sep 08, 2021 Sep 08, 2021

This should not be an issue. When the field is empty the SUM function treats it as zero. Is that not the case in your file? If so, then something is wrong there. What is the result, then, of this calculation? Can you share the actual file with us?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 08, 2021 Sep 08, 2021

Click here for the file - I didn't think it would be a problem either. It's a fairly simple calculation (at least it seems so)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2021 Sep 08, 2021
LATEST

The fields calculation order is incorrect. You have to move the Total field to the end of the list for it to work correctly. The rest seems fine to me.

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