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

If Amount is negative show zero

New Here ,
Jun 10, 2019 Jun 10, 2019

Copy link to clipboard

Copied

I am not familiar with JavaScript and just need it for one application. I have a fill able form that i created.

The Cells used are the following:

Grossamount (manual entry),

2% (=Grossamount*0.02),

SlipFee (manual entry)

The cell i am having trouble with is for the Additional Amount due.

Additional Amount due should be 2% - SlipFee. If the result is negative it should calculate Zero.

For Excel the equation is: =MAX(0,I24-I26) and it works perfectly fine, but i am having issues with that in my pdf file.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

65

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 ,
Jun 11, 2019 Jun 11, 2019

Copy link to clipboard

Copied

LATEST

You can use this code as the custom calculation script of that field:

var v1 = Number(this.getField("2%").valueAsString);

var v2 = Number(this.getField("SlipFee").valueAsString);

event.value = Math.max(0, v1-v2);

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