
1. Re: Can someone help me how to figure out the syntax for a calculation in an Acrobat fillable form?
George_Johnson Feb 3, 2011 6:50 PM (in response to NewbieMAH)You need to use JavaScript. It would be something like:
// Custom calculation script for Discount field
(function () {
// Get the subtotal value, as a number
var subtotal = +getField("Subtotal").value;
// Set this field's value
// If it's greater than 170, calculate 10%, otherwise it's zero
event.value = subtotal > 170 ? .1 * subtotal : 0;
})();
That last line is equivalent to:
if (subtotal > 170) {
event.value = .1 * subtotal;
} else {
event.value = 0;
}
It's just more compact.
Replace "Subtotal" in the getField line above with the actual name of the subtotal field. Also, set all calculated fields to readonly. And check to make sure the field calculation order is correct.

2. Re: Can someone help me how to figure out the syntax for a calculation in an Acrobat fillable form?
NewbieMAH Feb 3, 2011 7:31 PM (in response to George_Johnson)George, thank you for responding. I pasted in your code and made sure the naming formats were correct. What resulted was the figure "10%" appeared on the line that I reserved for the Discount (what I would like to appear is the actual monetary value of the discount  Subtotal X 10%) Also, the 10% of the Subtotal figure (in this case was $222.00) came out to $22.22, which should have given me a total of $199.80, but instead came back with a total of $212.00. I know I'm doing something wrong but don't know what!

3. Re: Can someone help me how to figure out the syntax for a calculation in an Acrobat fillable form?
George_Johnson Feb 3, 2011 7:51 PM (in response to NewbieMAH)You probably have the discount field set up to use a percentage format. Instead, it should be set to a number format.
The incorrect calculation could be due to the field calculation order being incorrect. To check it, go into forms editing mode (Form > Add or Edit fields) and select "Forms > Edit Fields > Set Field Calculation Order".

4. Re: Can someone help me how to figure out the syntax for a calculation in an Acrobat fillable form?
NewbieMAH Feb 4, 2011 7:16 AM (in response to George_Johnson)Of course you were absolutely correct on all accounts. Thank you so much for your help  it saved me hours of frustration!!

5. Re: Can someone help me how to figure out the syntax for a calculation in an Acrobat fillable form?
NewbieMAH Feb 4, 2011 11:21 AM (in response to George_Johnson)Hi George. I just noticed that the discount box is just giving a straight $10 discount, not a 10% discount based on what the Subtotal number is i.e. $10 discount whether the subtotal is $230 or $780. Any thoughts offhand what I'm doing wrong?
Mary Anne

6. Re: Can someone help me how to figure out the syntax for a calculation in an Acrobat fillable form?
George_Johnson Feb 4, 2011 11:47 AM (in response to NewbieMAH)The code I posted works for me. Are you using the exact same code? If so, it's hard to tell without seeing the file. I'd be happy to take a look if you are free to post it somewhere or or can email it to me. My addess is in my profile.

7. Re: Can someone help me how to figure out the syntax for a calculation in an Acrobat fillable form?
Starbuck68 Oct 4, 2011 11:31 AM (in response to George_Johnson)I sent you a PM with a similar question. I have no idea how to right the code.