Skip to main content
Known Participant
Jan 4, 2017 8:06 PM UTC
Answered

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 work

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.

This topic is closed to new replies. Start a new post to keep the conversation going.
George_JohnsonCorrect answer
Inspiring
Jan 4, 2017 8:46 PM UTC

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.

3 replies

Joel Geraci
Community Expert
Community Expert
Jan 4, 2017 8:22 PM UTC

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
Known Participant
Jan 4, 2017 8:30 PM UTC

Joel

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

Translate
George_JohnsonCorrect answer
Inspiring
Jan 4, 2017 8:46 PM UTC

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