Skip to main content
Participating Frequently
August 28, 2018
Answered

I need to replicate excel formula (D31)/SIN(RADIANS(D29)), using Simplified Field Notation

  • August 28, 2018
  • 2 replies
  • 1666 views

Is it possible for me to replicate excel formula (D31)/SIN(RADIANS(D29)) using Simplified Field Notation?  I have been playing around with Math.sin(x) but cannot seem to get it to work.  Let's just say that D31 is field "Intended Load in lbs." and D29 is field "Angle in degrees".  Should it be intendedloadinlbs/Math.sin(angleindegrees)? 

Any help would be greatly appreciated. 

This topic has been closed for replies.
Correct answer try67

First of all, move the code to be the field's custom calculation script.

Then, when you apply it, you should get this error message:

SyntaxError: missing ) in parenthetical

Fix that and then move on to the next problem, namely that you're not using Math.sin correctly, as it's a function and you need to provide it with a parameter within parentheses, for example:

Math.sin(90)


I'm going to help you out a bit with this... Try this code:

var v1 = Number(this.getField("slingsintendedload").valueAsString);

var v2 = Number(this.getField("Slingangleindegrees").valueAsString);

var v3 = Math.sin(degToRad(v2));

if (v3==0) event.value = "";

else event.value = v1 / v3;

function degToRad(v) {

    return v * (Math.PI/180);

}

2 replies

Brainiac
August 28, 2018

It wouldn't be   0.0174533(angleindegrees)  it would be  0.0174533*angleindegrees  to multiply.

Participating Frequently
August 28, 2018

I greatly appreciate it!  Between your advice and the self help link provided by try67, I have a better shot of getting this figured out than before I posted my question on the forum. 

Brainiac
August 28, 2018

Math.sin takes radians too, so you have to convert those degrees to radians. There's no function to do this, so just multiply by 0.0174533

Participating Frequently
August 28, 2018

Thank you Test Screen Name!  Just to make sure I am understanding correctly, would the text in Simplified Field Notation be (intendedloadinlbs/Math.sin(0.0174533(angleindegrees))

try67
Adobe Expert
August 28, 2018

You can't use the Simplified Field Notation to do it. It requires writing a custom calculation script.