Skip to main content
Participant
April 20, 2018
Question

PDF form calculation script.

  • April 20, 2018
  • 2 replies
  • 530 views

I am trying to create a PDF form calculation script for the following Excel formula =D11/G11*H11, and I do not have much experience at writing JavaScript. 

Portion Cost = case price / portions per case * portions per order,  any help would be appreciated. 

This topic has been closed for replies.

2 replies

Participant
April 23, 2018

Again you are a life saver.  Thank You

try67
Community Expert
Community Expert
April 20, 2018

You can use this code as the custom calculation script of "Portion Cost":

var v1 = Number(this.getField("case price").valueAsString);

var v2 = Number(this.getField("portions per case").valueAsString);

var v3 = Number(this.getField("portions per order").valueAsString);

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

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