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

Using the Absolute Function

Explorer ,
Feb 17, 2020 Feb 17, 2020

Copy link to clipboard

Copied

Hi All Ive got the following script working to give me the difference between two fields, but would like the answer to always appear as a positive number i.e. the absolute number even if the result is negative.

 

event.value =this.getField("BOW").value - this.getField("Ahead_Mark").value;

 

Im just not sure how to put the Maths.abs function or if this is even the right function to use.

 

Thanks in advance.

TOPICS
Edit and convert PDFs

Views

1.1K

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 , Feb 18, 2020 Feb 18, 2020

Use this:

event.value = Math.abs(Number(this.getField("BOW").valueAsString) - Number(this.getField("Ahead_Mark").valueAsString));

Votes

Translate

Translate
Community Expert ,
Feb 18, 2020 Feb 18, 2020

Copy link to clipboard

Copied

Use this:

event.value = Math.abs(Number(this.getField("BOW").valueAsString) - Number(this.getField("Ahead_Mark").valueAsString));

Votes

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
Explorer ,
Feb 18, 2020 Feb 18, 2020

Copy link to clipboard

Copied

Perfect - thank you for your help.

 

cheers

LC

Votes

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 ,
Aug 04, 2020 Aug 04, 2020

Copy link to clipboard

Copied

LATEST

Man, I've been trying to figure this out for days. Thank you for the answer, Bernd_Alheit!

I had no problem creating something like this using Formcalc in the old Livecycle Designer. But with Acrobat Pro DC, which I just started using last week, I was completely lost on how to achieve an Absolute Value like this.

If these forums had a tip jar, I'd put money in yours. You saved the day!

Votes

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