I inherited an application which is failing to calculate correctly. I have a table defined as follows:
Just to understand the usage a bit, the first field prefixed with "o_' is original followed by "e_"xtras, "d_"eductions, "r_"evised, "a_"ctual and finally "b_"alance. Also all the calculated fields are stored in the database.
The following is what is seen on the screen. Note that the e_labor, d_labor and a_labor figures are correct.
In the above, the last line should be $31,459.70 which is off by $2000. Note that if I change the calculation of the balance figure as follows the figures calculate corectly:
[red]The question is why was it failing? What is the order in which calculated fields are resolved? Was the b_labor being calculated prior to the r_labor used in the original calculation?[/red]
TIA
Mark
Code:
o_labor number (manually entered at data entry)
e_labor calculation (number) =sum(extra_labor)
d_labor calculation (number) =sum(deduct_labor)
r_labor calculation (number) =o_labor + e_labor - d_labor
a_labor number (manually posted via a script in another table)
b_labor calculation (number) =r_labor - a_labor
extra_labor number repeating field with 25 repetitions
deduct_labor number repeating field with 25 repetitions
Just to understand the usage a bit, the first field prefixed with "o_' is original followed by "e_"xtras, "d_"eductions, "r_"evised, "a_"ctual and finally "b_"alance. Also all the calculated fields are stored in the database.
The following is what is seen on the screen. Note that the e_labor, d_labor and a_labor figures are correct.
Code:
o_labor $88,500.00
e_labor $9,766.50
d_labor $2,000.00
r_labor $96,266.50
a_labor $64,806.80
b_labor $33,459.70
In the above, the last line should be $31,459.70 which is off by $2000. Note that if I change the calculation of the balance figure as follows the figures calculate corectly:
Code:
b_labor calculation (number) =o_labor + e_labor - d_labor - a_labor
[red]The question is why was it failing? What is the order in which calculated fields are resolved? Was the b_labor being calculated prior to the r_labor used in the original calculation?[/red]
TIA
Mark