Copy link to clipboard
Copied
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.
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.
Copy link to clipboard
Copied
You're only getting the field object, not the value of the field. Try..
this.getField("Thickness").value/Math.cos(this.getField("TransducerAngle").value)
Copy link to clipboard
Copied
Joel
Thanks for your reply I tried it but it is not returning a value.
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now