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

Need Help! Need to multiply

krazyanna
Registered: Jun 9 2010
Posts: 2

I would like to multiply a quantity with a cost and get an amount

UnitLn13 * UnitPrice13 = Amt13

Many thanks!

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Did you use LiveCycle Designer or Acrobat's Form Tool to create the form?

For Acrobat forms, [url=http://www.acrobatusers.com/tutorials/2006/form_calculations]How to do (not so simple) form calculations] by Thom Parker.

For LiveCycle Designer see the 'Scripting Reference' under LiveCycle Designer's 'Help' menu option.

There are also eSeminars on demand on this site that show how to create forms in Acrobat and LiveCycle Designer.

George Kaiser

RogerAg
Registered: Aug 5 2010
Posts: 8
Hello gkaiseril

I realy don’t understand JavaScript, its just a foreign language to me. I did go to “http://”www.acrobatusers.com/tutorials” as you suggested, it made no since to me.

Now I not the brightest penny in the roll and my math skills are basic, I can sometimes add, subtract, divide and Multiply, without too much problems, however doing it in Adobe Acrobat is frustrating. I am working on a form that I need to add two forms from the “forms tools” That was no problem because in the “Forms Properties” Adobe Acrobat has a simple calculation for adding two forms together.

I was able to subtract two forms only because YOU had helped someone else and I copied your custom calculation script. The script that I used from you was: // compute the difference of the estimated value less the actual value
event.value = this.getField("Account before Payment").value - this.getField("Total owed").value;

However I still can’t Multiply or Divide. Can you give me a simple script for those two functions (if so my life would be complete.)
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Just replace "-" with "*" or "/", respectively.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

RogerAg
Registered: Aug 5 2010
Posts: 8
Hi try67

yes I went to your site, but I could not find the script for Multiplying or dividing.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
It has nothing to do with my site. All you need to do is replace the minus sign from gkaiseril's code with the multiplication or division sign.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Be careful because division by zero can result in an answer of 'Infinity' or '- Infinity' both of which are numbers but do not fit well in an Acrobat numeric field.

George Kaiser

RogerAg
Registered: Aug 5 2010
Posts: 8
I keep getting messages such as: The value entered does not match the format of the field [% of Bill]

Also some of the forms do not reset when I change amounts. Adobe Acrobat is so frustrating.
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
First, you might want to set the format of the field where this calculation is being made to "None" and observe the value the value that appears in the field.

The only options for division calculation when a division by zero or a null value (treated like zero) is possible is the custom calculation script or a format of "None" and one programming the formatting of the result.
// variables for computation// enter field names between quotation marksvar cDivisor = "Divisor Field Name";var cDividend = "Dividend Field Name";// do not make edits below this lineevent.value = ""; // assume null value for quotientvar fDivisor = this.getField(cDivisor).value; // divisor valuevar fDividend = this.getField(cDividend).value; // dividend value// check for non-zero divisorif (fDivisor != 0) {// calculate for non-zero divisors onlyevent.value = fDividend / fDivisor; // compute quotient}

George Kaiser

RogerAg
Registered: Aug 5 2010
Posts: 8
Wow that works
Thanks gkaiseril

Now how did you do that?
To me its gobbledygook

Thank you again

RogerAg