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.
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;
Copy link to clipboard
Copied
So you just want field1*field2*field3?
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
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;
Copy link to clipboard
Copied
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.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more