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

Excel to Custom Calculation Script

New Here ,
May 03, 2019 May 03, 2019

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
946
Translate
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);

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

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

Translate
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

"Same_Day_Miles"

Translate
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

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);

Translate
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
LATEST

You are a life saver my friend!

Translate
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