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

I have the following formula in a form "this.getField("Thickness")/Math.cos(this.getField("TransducerAngle")). I am trying to calculate T/cosine(X degrees) where T is the Thickness and X is the Angle. this is my best effort at it but it is not working.

New Here ,
Jan 04, 2017 Jan 04, 2017

I have the following formula in a form "this.getField("Thickness")/Math.cos(this.getField("TransducerAngle")).  I am trying to calculate T/cosine(X degrees) where T is the Thickness and X is the Angle.  this is my best effort at it but it is not working.

TOPICS
Acrobat SDK and JavaScript
545
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

correct answers 1 Correct answer

LEGEND , Jan 04, 2017 Jan 04, 2017

You will need to correctly convert the value in degrees to radians to use the Math.cos method. Also, check the JavaScript console (Ctrl + J) to see if any error are reported. Finally, since the denominator could conceivably be zero (or very close), you should not perform the division if it is and set the field value to something else, perhaps blank.

Translate
Community Expert ,
Jan 04, 2017 Jan 04, 2017

You're only getting the field object, not the value of the field. Try..

this.getField("Thickness").value/Math.cos(this.getField("TransducerAngle").value)

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
New Here ,
Jan 04, 2017 Jan 04, 2017

Joel

Thanks for your reply I tried it but it is not returning a value.

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
LEGEND ,
Jan 04, 2017 Jan 04, 2017
LATEST

You will need to correctly convert the value in degrees to radians to use the Math.cos method. Also, check the JavaScript console (Ctrl + J) to see if any error are reported. Finally, since the denominator could conceivably be zero (or very close), you should not perform the division if it is and set the field value to something else, perhaps blank.

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