Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


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

Community Beginner ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

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!

Beemonkie_0-1626139311735.png

 

TOPICS
JavaScript

Views

45

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

Adobe Community Professional , Jul 12, 2021 Jul 12, 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....

Likes

Translate

Translate
Community Beginner ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

OH! I am using Adobe Acrobat Pro DC

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
Adobe Community Professional ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

Use Javascript at Custom Calculation Script.

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
Adobe Community Professional ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

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 = "";

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 Beginner ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

LATEST

THANK YOU SOOOOO MUCH!! It works perfectly!!

Thank you!

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