I currently have a fillable PDF with a field called 'Total Chargeable Amount'. This is calculated by the sum of 10 other fields, which are all named 'A_1' up to 'A_10'.
Can anyone tell me what I should put in the 'Custom calculation script' field to do this?
I am not sure what you are trying to achieve, the field can be editable that is not a problem, but if we run a 'custom calculation script', this will run every time a field is exited, included the total field. This would mean that the user would edit the field, and then click or tab to another field, the calculations would run and then whatever they typed in would be overwritten.
I am sure this is not what you want to happen.
Essentially, the Total Chargeable Amount may be less than the amount that is automatically calculated if a discount has been applied.
The changes that are made at the moment are overwritten as soon as you click away from the Total field, as you described.
Is there a way to prevent this from happening?
I would recommend you create a separate field for the discount amount, and then include its value in the calculation of the total.
Thanks try67. This is the fall back. The issue is we don’t want to ‘promote‘ discounts, if that makes sense.
Is there no way through applying code to do this?
Copy link to clipboard
There is but it would be a lot of work, as you would have to try and work out when a value is to be calculated, and then if the total field is edited, stop the calculation, but what if something in one of the calculated fields is changed, do we then run the calculation again, and then the user would have to enter the discount again, and then we have to stop the calculation again, and so on and so on.
It would be tricky to get this right, a much easier option is the one mentioned by try67 which is to have a field that would be included in the sum to introduce the discount, although there is no need to call it "discount' you woundn't even have to name it you could just have a blank empty field, which is a discount when it has a value of nothing when it doesn't.