Skip to main content
Participant
July 13, 2021
解決済み

How to custom calculate for a form field based on the total in another field. Tiered calculations

  • July 13, 2021
  • 返信数 3.
  • 1084 ビュー

Hi There! Super new to all of this so bare with me. There are 2 form fields that I am trying get to automatically calculate the tiered discount and tiered shipping... according to what the Subtotal is.

The TOTALDiscount Field and the TOTALSHIPPING field.

 

TOTALDiscount- I need to automatically calculate the discount received according to the SUBTOTAL and the following tier:
5% discount off of Subtotal for Subtotal that is $3500-$6999

10% discount off of Subtotal for Subtotal that is $7000 or more.

 

TOTALSHIPPING - I need to automatically calculate the shipping cost according to the SUBTOTAL and the following tier:

15% calculation of Subtotal if Subtotal is $1-$500

10% calculation of Subtotal if Subtotal is $501-$1000

7% calculation of Subtotal if Subtotal is $1001-$5000

4% calculation of Subtotal if Subtotal is $5001 or more

 

I hope this makes sense! Thank you for your help!

 

このトピックへの返信は締め切られました。
解決に役立った回答 Nesa Nurani

Put script as "Custom calculation script" in:

TOTALDiscount:

var sub = this.getField("SUBTOTAL").value;
if(sub >= 3500 && sub <= 6999) event.value = sub*.05;
else if(sub >= 7000) event.value = sub*.10;
else event.value = "";

 

TOTALSHIPPING:

var sub = this.getField("SUBTOTAL").value;
if(sub >=1 && sub <=500) event.value = sub*.15;
else if(sub >=501 && sub <=1000) event.value = sub*.10;
else if(sub >=1001 && sub <=5000) event.value = sub*.07;
else if(sub >=5001) event.value = sub*.04;
else event.value = "";

返信数 3

Nesa Nurani
Community Expert
Nesa NuraniCommunity Expert解決!
Community Expert
July 13, 2021

Put script as "Custom calculation script" in:

TOTALDiscount:

var sub = this.getField("SUBTOTAL").value;
if(sub >= 3500 && sub <= 6999) event.value = sub*.05;
else if(sub >= 7000) event.value = sub*.10;
else event.value = "";

 

TOTALSHIPPING:

var sub = this.getField("SUBTOTAL").value;
if(sub >=1 && sub <=500) event.value = sub*.15;
else if(sub >=501 && sub <=1000) event.value = sub*.10;
else if(sub >=1001 && sub <=5000) event.value = sub*.07;
else if(sub >=5001) event.value = sub*.04;
else event.value = "";

Beemonkie作成者
Participant
July 13, 2021

THANK YOU SOOOOO MUCH!! It works perfectly!!

Thank you!

Bernd Alheit
Community Expert
Community Expert
July 13, 2021

Use Javascript at Custom Calculation Script.

Beemonkie作成者
Participant
July 13, 2021

OH! I am using Adobe Acrobat Pro DC