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

Using the Absolute Function

Explorer ,
Feb 17, 2020 Feb 17, 2020

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
1.7K
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
1 ACCEPTED SOLUTION
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));

View solution in original post

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

Use this:

event.value = Math.abs(Number(this.getField("BOW").valueAsString) - Number(this.getField("Ahead_Mark").valueAsString));
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
Explorer ,
Feb 18, 2020 Feb 18, 2020

Perfect - thank you for your help.

 

cheers

LC

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

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