Highlighted

Using the Absolute Function

New Here ,
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.

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Use this:

event.value = Math.abs(Number(this.getField("BOW").valueAsString) - Number(this.getField("Ahead_Mark").valueAsString));
TOPICS
Edit and convert PDFs

Views

50

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

Using the Absolute Function

New Here ,
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.

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Use this:

event.value = Math.abs(Number(this.getField("BOW").valueAsString) - Number(this.getField("Ahead_Mark").valueAsString));
TOPICS
Edit and convert PDFs

Views

51

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
Feb 17, 2020 0
Adobe Community Professional ,
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));

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
Reply
Loading...
Feb 18, 2020 0
New Here ,
Feb 18, 2020

Copy link to clipboard

Copied

Perfect - thank you for your help.

 

cheers

LC

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
Reply
Loading...
Feb 18, 2020 0
Community Beginner ,
Aug 04, 2020

Copy link to clipboard

Copied

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!

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
Reply
Loading...
Aug 04, 2020 0