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

Calculated field not showing value

New Here ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Hi all! I am still very new to learning javascript and using acrobat, one issue I'm running into pretty consistently.

I've made a custom calculation script in order to take in the values from two fields and display the calculation value in another field.

This is the script I've gotten to after reading a lot of different posts here, and some very basic javascript courses:

var v1 = Number(this.getField("MEASURE1").value);
var v2 = Number(this.getField("TEMP1").value);
event.value = Math.round(v1/(2**((77-v2)/27)))

MEASURE1 is the measured resistance, TEMP1 is the ambient temperature at the time of the test. Both are the names of the fields I want to pull from. The goal is to have the value automatically corrected and displayed to be more accurate and not have our test technician do it on a calculator, so we save time and have less errors.

I feel like it should be simple enough but the value will not display, is something missing?

Any input would be appreciated! 

TOPICS
JavaScript

Views

412

Translate

Translate

Report

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

Community Expert , Aug 02, 2022 Aug 02, 2022

If you are trying to use exponent, you need to use Math.pow() like this:

event.value = Math.round(v1/(Math.pow(2, (77-v2)/27)));

Votes

Translate

Translate
Community Expert ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

If you are trying to use exponent, you need to use Math.pow() like this:

event.value = Math.round(v1/(Math.pow(2, (77-v2)/27)));

Votes

Translate

Translate

Report

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

It worked, thank you so much!

Would you happen to be able to explain why ** wouldnt work in this situation?

 

Votes

Translate

Translate

Report

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
Community Expert ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Because that's not a valid operator in JavaScript.

Votes

Translate

Translate

Report

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 ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

LATEST

Oh alright, must've gotten it mixed up with something else then. Thank you!!

Votes

Translate

Translate

Report

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