May I understand the issue like you have create a code, which in the page trigger OnAfterGetRecord is updating the amount field? And then you don’t understand why it updates the field every time the user opens the page?
First, you should NEVER have actual code on pages. Only simple lookups etc.
Second, could you please explain exactly what it is that you’re trying to accomplish? And what if the user browses to the next record and back? Should it also not update the record here?
I encountered this problem before. What happens is that each time you activate a colmn field of another record, the OnafterGetRecord" is triggered.
Normally you would settle for at Total field outside the tablebox, but i guess you could somehow build a subtotal if you really wanted. If someone have a better solution I would like to hear it.
If you know the position of each record in the table (ie. which record is the first, the second and so on), you would know which value to insert into the variable doing the following.
You could create a tempoary version of the table and copy filters and so on. You could then use some field for numbering and subtotal. It does not really matter as the temp table would sit in memory of the users computer only.
On the OnAfterGetRecord trigger you could count the “real” records and copy the subtotal from the Temp table with that same numbering…