• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Excel to Custom Calculation Script

New Here ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

How would this Excel formula translate to a custom calculation script in a PDF form?

=IF(A4<=10, 16.68,16.68+((A4-10)*1.67))

Thanks!

TOPICS
Acrobat SDK and JavaScript

Views

218

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

Community Expert , May 03, 2019 May 03, 2019

You can use this code as the custom calculation script of your field, then:

var v = Number(this.getField("Same_Day_Miles").valueAsString);

if (v<=10) event.value = 16.68;

else event.value =16.68+((v-10)*1.67);

Likes

Translate

Translate
Community Expert ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

What's the name of the "A4" field in the PDF?

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
New Here ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

"Same_Day_Miles"

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 Expert ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

You can use this code as the custom calculation script of your field, then:

var v = Number(this.getField("Same_Day_Miles").valueAsString);

if (v<=10) event.value = 16.68;

else event.value =16.68+((v-10)*1.67);

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
New Here ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

LATEST

You are a life saver my friend!

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