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

Simplified Field Notation not Subtracting

Bvoss
Registered: Sep 7 2007
Posts: 4

I am using Acrobat Pro 8 with Windows XP. All my fields have a format of

function MyNumberFormat()
{
if(event.value==0)
event.value="";
else
AFNumber_Format(2,0,0,0,"",false);
}

The calculations are
FieldA * FieldB = FieldC (this is done in the 'Value is' calculation)
FieldC - FieldD = FieldE (this is done in the 'Simplified Field Notation')

I enter Field A & Field B and the calculation works for Field C.
I enter Field D but do not get the result for Field E.

I am also having trouble with the calculations being a step off. I need to complete the next step in order the calculations to be correct. Sometimes there is not a next step needed.

I have checked the calculation order and it is right. Any ideas?

P.S. I have a temporary fix by summing FieldC and inputting FieldD with a negative number.

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
You should make the field's format numeric with 2 decimal places, and use the following field validation script:

if (event.value == 0) event.value = "";

Then for FieldC's simplified field notation script would be:

FieldA * FieldB

For FieldE's simplified field notation would be:

FieldC - FieldD

But, I would use the custom calculation Script in FieldE's custom calculation script to do all the work and not use any custom validation, custom format or any of the shortcut calculations. All the numeric fields would be formatted to number with 2 decimal places and the custom calculation script would be:

// multiply FieldA by FieldB
this.getField("FieldC").value = this.getField("FieldA").value * this.getField("FieldB").value;
if (this.getField("FieldC").value == 0) this.getField("FieldC").value = ""; // suppress zero result
// subtract FieldD from FieldC
this.getField("FieldE").value = this.getField("FieldC").value - this.getField("FieldD").value;
if (this.getField("FieldE").value == 0) this.getField("FieldE").value = ""; // suppress zero result

With this approach, all the calculations are preformed in the order I want and not in the order that the fields were created.

George Kaiser