Skip to main content
Inspiring
November 7, 2018
Answered

Script with multiple fields calculated and leave blank no data

  • November 7, 2018
  • 3 replies
  • 876 views

Looking for some assistance for a script that runs the calculations below based on the fields but also leaves the final field blank if nothing is in the other fields.   

E12*E13*(E14/100)/2000

For example:

25*12.2*(27.5/100)/2000=0.0419

Any assistance is greatly appreciated.

DH

This topic has been closed for replies.
Correct answer donaldh85713671

It's fixed! Thanks for catching that, don't know how I missed it. Much appreciated!

3 replies

donaldh85713671AuthorCorrect answer
Inspiring
November 16, 2018

It's fixed! Thanks for catching that, don't know how I missed it. Much appreciated!

Inspiring
November 7, 2018

Thank you for your quick response!  What would be the script for this one? 

B10*C10*(D10/100)*(E10/100)/2000

76*9.42*(14.5/100)*(33/100)/2000=0.0171

try67
Community Expert
Community Expert
November 7, 2018

Just follow the same logic I provided above...

You should also read this tutorial: https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

Inspiring
November 13, 2018

Thanks for your help on the script and reference materials.  Any idea what is causing the output box (0.0348) to produce a shadow behind it?

var v1 = this.getField("J10").valueAsString;

var v2 = this.getField("K10").valueAsString;

var v3 = this.getField("L10").valueAsString;

var v4 = this.getField("M10").valueAsString;

if (v1=="" || v2=="" || v3=="" || v4=="") event.value = "";

else event.value = Number(v1)*Number(v2)*((Number(v3)/100)*((100-Number(v4))/100)/2000);

try67
Community Expert
Community Expert
November 7, 2018

Use this code as the custom calculation script of the field where you want to show the result:

var v1 = this.getField("E12").valueAsString;

var v2 = this.getField("E13").valueAsString;

var v3 = this.getField("E14").valueAsString;

if (v1=="" || v2=="" || v3=="") event.value = "";

else event.value = Number(v1)*Number(v2)*((Number(v3)/100)/2000);