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.
Copy link to clipboard
Copied
Use this:
event.value = Math.abs(Number(this.getField("BOW").valueAsString) - Number(this.getField("Ahead_Mark").valueAsString));
Copy link to clipboard
Copied
Use this:
event.value = Math.abs(Number(this.getField("BOW").valueAsString) - Number(this.getField("Ahead_Mark").valueAsString));
Copy link to clipboard
Copied
Perfect - thank you for your help.
cheers
LC
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!

