I have a child table that calculates the value of one field (discount amount) based on the value of another field in the child table (base amount). The standard formula is base amount * .98. Simple enough. Now, I have in the parent table a logical variable - Discount Allowed (Y/N). I've modified the formula for the calculated field in the child table as follows:
BASE_AMOUNT -IIF(LOOKUPL("F",BILLS_UID,"Discount_Allowed","bills","Uid"), BASE_AMOUNT * (LOOKUPN("F",1,"Disc1_percent","control","Uid")/100),0)
This works perfectly if I set the Discount Allowed field prior to entering anything into the Base Amount field of the child table. When the Discount Allowed field is TRUE and I enter 100 in the Base Amount Field, Alpha sets the Discount field to 98. The problem is if the user needs to change the Discount Allowed after the fact. The numbers in the calculated field should change to reflect the new condition but even if I type the numbers again in the Base Amount field Alpha seems to "remember" the original calculation and not reset the calculated field to the new amount. In the above example if I set the Discount Allowed field to FALSE in the parent record and then re-enter 100 in the Base Amount field of the child record the Discount field still calculates to 98. Conversely if I originally had the Discount Allowed field equal to FALSE and entered 100 the discount amount shows 100 and will not change no matter what I put in the Discount Allowed field.
Is this a bug, a feature? If so, how do I force the correct figures into the Discount fields of the child table. The child table is a 1-many and typically there will be five to six child records that each need to be recalculated.
I hope this isn't too confusing!
BASE_AMOUNT -IIF(LOOKUPL("F",BILLS_UID,"Discount_Allowed","bills","Uid"), BASE_AMOUNT * (LOOKUPN("F",1,"Disc1_percent","control","Uid")/100),0)
This works perfectly if I set the Discount Allowed field prior to entering anything into the Base Amount field of the child table. When the Discount Allowed field is TRUE and I enter 100 in the Base Amount Field, Alpha sets the Discount field to 98. The problem is if the user needs to change the Discount Allowed after the fact. The numbers in the calculated field should change to reflect the new condition but even if I type the numbers again in the Base Amount field Alpha seems to "remember" the original calculation and not reset the calculated field to the new amount. In the above example if I set the Discount Allowed field to FALSE in the parent record and then re-enter 100 in the Base Amount field of the child record the Discount field still calculates to 98. Conversely if I originally had the Discount Allowed field equal to FALSE and entered 100 the discount amount shows 100 and will not change no matter what I put in the Discount Allowed field.
Is this a bug, a feature? If so, how do I force the correct figures into the Discount fields of the child table. The child table is a 1-many and typically there will be five to six child records that each need to be recalculated.
I hope this isn't too confusing!
Comment