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

MULTIPLE FIELD CALCULATIONS

Explorer ,
Oct 15, 2020 Oct 15, 2020

Copy link to clipboard

Copied

Hi, Sorry to be asking again but I need some more help. 

I am trying to set up a PDF form in Acrobat 2017 to calculate the total of some cells. i.e    Field1 is CITY_RATE,  Field2 is COUNTRY_RATE, Field3 is NUMBER_DAYS and Field4 is TOTAL$ 

So if there is an entry in Field1 it is multiplied by Field3.  Using the calculate tab in properties I have been able to do this using "CITY_BFAST$, NUMBER_DAYS which does work.  But I want to set it up so that if I enter details in both Field1 & 2 they will both multiply by Field3 to give me a total in Field4 and this is where I am stumped.

Any assistance would be very much appreciated.

TOPICS
Acrobat SDK and JavaScript

Views

125

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
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 16, 2020 Oct 16, 2020

Try this in field4 as custom calculation script:

var f1 = this.getField("Field1").value;
var f2 = this.getField("Field2").value;
var f3 = this.getField("Field3").value;
event.value = f1*f2+f2*f3;

Likes

Translate

Translate
Enthusiast ,
Oct 15, 2020 Oct 15, 2020

Copy link to clipboard

Copied

So you just want field1*field2*field3?

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
community guidelines
Explorer ,
Oct 16, 2020 Oct 16, 2020

Copy link to clipboard

Copied

Hi Asim123.  Unfortunately, field1*field2*field3 won't work.

I need something like:

Field1 * Field 3 + Field 2* Field3 with both results summed in Field 4 but i can't figure out how to make that happen

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
community guidelines
Community Expert ,
Oct 16, 2020 Oct 16, 2020

Copy link to clipboard

Copied

Try this in field4 as custom calculation script:

var f1 = this.getField("Field1").value;
var f2 = this.getField("Field2").value;
var f3 = this.getField("Field3").value;
event.value = f1*f2+f2*f3;

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
community guidelines
Explorer ,
Oct 17, 2020 Oct 17, 2020

Copy link to clipboard

Copied

LATEST

Thank NesaNurani,  I made one little tweak (changed event.value = f1*f2+f2*f3; to event.value = f1*f3+f2*f3;) and it worked perfectly, exactly what I was after.

I have been trying to learn everything I can from the web, tutorials etc.  but nothing can beat the expertise of people like yourself, so thank you again.

 

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
community guidelines