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

Adding math to a variable

ecburris
Registered: Nov 11 2008
Posts: 15

From thomp's parts example http://www.acrobatusers.com/tutorials/2 … livecycle/ I want to add some math to the variable see below:

I want one of the selections from the dropdown to also do math so my question is can that be done for example; can the varialbe multiply to come up with a percentage. If I have a number between 75,000.01 and 100,000.00 (the actual number is in another cell) and want to know what 30% of that number is, can I have the math in the variable.

Percent:[ ["-","None"], ["75,000.01 - 100,000.00",.030*form1.#subform[0].Gross_GCA]]

Of course the way it is now does not work. I am hoping that you can help me with this.

Earl

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can in fact place a calculation into a data object definition, just as you've shown. However, the code in this example is in JavaScript, not FormCalc. So field values have to be referenced directly using JavaScript syntax. Part of doing this is naming all of your subforms. Do not leave your subforms unnamed. For example, lets say that you rename "#subform[0]" to "MySubForm". The calculation above would be

0.030 * form1.MySubForm.Gross_GCA.rawValue

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script