Can I use {sum_amount} in a Form

Can I use {sum_amount} in a Form application in the Events AfterInsert or AfterUpdate or AfterDelete? The emphasis here is this is in a Form app not a Grid.

The objective is to get the total SUM of a column called “amount” specific to a unique “ordernumber” into a variable, which I can then use to update another table.

Thus assuming ordernumber=1
(in the Forms SQL Where clause ordernumber=‘1’)
and there were say 5 records belonging to ordernumber = 1, each with a value in their respective “amount” field

If I used $Total={sum_amount}, would $Total equal the sum of the column ‘amount’ for that ordernumber=1

If not what is the most efficient way of doing this?

Thanks in advance

[QUOTE=Larryh1115;36090]Can I use {sum_amount} in a Form application in the Events AfterInsert or AfterUpdate or AfterDelete? The emphasis here is this is in a Form app not a Grid.

The objective is to get the total SUM of a column called “amount” specific to a unique “ordernumber” into a variable, which I can then use to update another table.

Thus assuming ordernumber=1
(in the Forms SQL Where clause ordernumber=‘1’)
and there were say 5 records belonging to ordernumber = 1, each with a value in their respective “amount” field

If I used $Total={sum_amount}, would $Total equal the sum of the column ‘amount’ for that ordernumber=1

If not what is the most efficient way of doing this?

Thanks in advance[/QUOTE]

The trick would be to use an event to calculate the sum and display it on your form. Therefore you need to create a custom field and apply the correct sql on the onload event. In this event your record is loaded and your (key) values are available to be used in your custom sql. Apply the value retrieved from your sql to your custom field and you’re done.