Skip to main content
Hoey
Known Participant
Dec 11, 2017 9:44 PM UTC
Answered

Need some help using Natural Logarithm/LN Calculation

I have a couple text boxes as follows:

text1 = number that doesn't change (6.5459673)

text2 = number that will change based on input from another text box (box1F6)

in excel the calculation would be: 6.5459673 (or text1) * (LN(F6))

I tried doing this:

var nBox = + getField("box1F6").value;

event.value = math.log(nBox);

but that didn't even put a 0 or any input for that matter. 

Any help is appreciated! Thanks in advance!

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Dec 11, 2017 9:49 PM UTC

Should work, only it's Math.log(), not math.log()... JS is case-sensitive, so the latter would cause an error.

2 replies

Thom Parker
Community Expert
Community Expert
Dec 11, 2017 9:49 PM UTC

Was there an error reported in the console?

Is this code entered into the Calculation Script?

Do you know that the value of "box1F6" is a number?

And math needs to be capitalized:  Math.log();

Try this. add this line to  your code immediately after the "getField" line

console.pritnln("Val=" + nBox);

Here is a tutorial on using the Console Window.

The Acrobat JavaScript Console Window - YouTube

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Dec 11, 2017 9:49 PM UTC

Should work, only it's Math.log(), not math.log()... JS is case-sensitive, so the latter would cause an error.

Translate