These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Tricky math problem

dooda48
Registered: Apr 28 2008
Posts: 15
Answered

Hi guys, I am working on a livecycle form for a client and am stumped as to replicate a formula which the client has created in Excel.
I have scoured the net for two days trying to find the answer, and I seem to be getting close with Javascript, but no real joy.
The Excel file is uploaded here: http://groups.google.com/group/livecycle/web/measurement_doc.xls
And the (incomplete) form is here:
http://groups.google.com/group/livecycle/web/Measurement%20page_update.pdf

The calculation (in Cell E36 and E37) contains a LOG10 algorithm as part of the calculation, which I think can be replicated using the Math.log(10) function in Javascript, I’m just not sure if it works in Livecycle.

This is driving me nuts, but also means the form is lacking a crucial element which the client really wants.

I am willing to pay if someone can write the script that replicates exactly what Cell E36 does!

As usual your expertise is very very much appreciated.

Cheers guys,
Dooda

My Product Information:
LiveCycle Designer, Windows
scottsheck
Registered: May 3 2007
Posts: 138
I can get it working for you if you wish. Email me at scottsheck [at] yahoo [dot] comThanks,
Scott
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
You maybe able to use undocumented FormCalc functions as reported in [url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=14073]Undocumented FormCalc Scientific Functions[/url] or the JavaScirpt "Math.ln10()" method.

George Kaiser

dooda48
Registered: Apr 28 2008
Posts: 15
Thanks so much Scott, you saved my bacon with the great piece of scripting you completed for me.

I just wanted to post this as a testimonial to everyone, and that if you have any Javascript conundrum that you cannot solve on the forums, Scott is your man scottsheck [at] yahoo [dot] comI know the idea is that we all learn from the forums but when client deadlines are tight or looming sometimes you just have to bite the bullet and pay for the answer.

Thanks again Scott, great work.
Doug
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
And thank you for sharing the solution.

George Kaiser

scottsheck
Registered: May 3 2007
Posts: 138
Your very welcome Doug. In case this of any value to anyone, Excel has a log function where you can specify the base, but javascript only provides a log function to the base e. But it is still possible to calculate the log of any number base 10 by using the following javascript: Math.log(3)/Math.log(10). This example will return the logarithm of 3 base 10.

As gkaiseril points out, javascript also supports a constant Math.LN10 which is equal to Math.log(10, so you can also use the formula: Math.log(3)/Math.LN10