Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Exit

- Home
- Acrobat SDK
- Discussions
- I need to replicate excel formula (D31)/SIN(RADIAN...

- I need to replicate excel formula (D31)/SIN(RADIAN...

0

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/td-p/9985736
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

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.

TOPICS

Acrobat SDK and JavaScript
,
Windows

Community guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Community Expert
,
Aug 29, 2018
Aug 29, 2018

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);

}

15
Replies
15

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985737#M19053
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

Community guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

chriss97439594
AUTHOR

Community Beginner
,

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985738#M19054
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

Community guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985739#M19055
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

Community guidelines

chriss97439594
AUTHOR

Community Beginner
,

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985740#M19056
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

Community guidelines

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985741#M19057
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

A good place to start: https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations

Community guidelines

chriss97439594
AUTHOR

Community Beginner
,

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985743#M19059
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

Thank you for your help!

Community guidelines

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985742#M19058
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

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

Community guidelines

chriss97439594
AUTHOR

Community Beginner
,

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985744#M19060
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

Community guidelines

chriss97439594
AUTHOR

Community Beginner
,

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985745#M19061
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

Does this look more like it? intendedloadinlbs/Math.sin0.0174533*angleindegrees

Community guidelines

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985746#M19062
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

I suggest you study this page quite carefully: JavaScript Math Reference

Community guidelines

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985747#M19063
Aug 28, 2018
Aug 28, 2018

Copy link to clipboard

Copied

Community guidelines

chriss97439594
AUTHOR

Community Beginner
,

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985748#M19064
Aug 29, 2018
Aug 29, 2018

Copy link to clipboard

Copied

Thank you for the help. I am certainly no expert, which is why I am hoping someone can throw me a lifeline on this forum. I have taken all suggestions and came back with this custom validation script. I pray I am close to where I need to be. Any suggestions would be greatly appreciated.

event.value = ( this.getField("slingsintendedload").value / Math.sin * 0.0174533 * this.getField("Slingangleindegrees").value

Community guidelines

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985749#M19065
Aug 29, 2018
Aug 29, 2018

Copy link to clipboard

Copied

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)

Community guidelines

/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985750#M19066
Aug 29, 2018
Aug 29, 2018

Copy link to clipboard

Copied

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);

}

Community guidelines

chriss97439594
AUTHOR

Community Beginner
,

LATEST
/t5/acrobat-sdk-discussions/i-need-to-replicate-excel-formula-d31-sin-radians-d29-using-simplified-field-notation/m-p/9985751#M19067
Aug 29, 2018
Aug 29, 2018

Copy link to clipboard

Copied

Community guidelines

Copyright © 2023 Adobe. All rights reserved.