Skip to main content
Answer

recalculate grid values (Totals)

  • September 1, 2021
  • 4 replies
  • 333 views

Hi good night.

 

I have a problem. I need to re-calculate the values ​​of the “Accumulated amount” column every time I make a change in any column of the grid (specially the colum TotalAmount). re-calculated de values and show in the grid.
The business rule for the “Accumulated total amount” column is as follows:sum current row + previous row. (in the first row the previous row is zero).
the result that I would expect
I used this code in the row_updated event but it doesn't work as I expect. (This code is in the Row_Updated Event
//In this code for each interaction 1 is added so if I have a grid with 4 rows in AccumulatedAmount //it should look like: 1,2,3,4 but it doesn't work

int cont = 0;

foreach (CEEstimateAddOn soLine in this.viewCEEstimateAddOn.Select())
{
cont+=1;
soLine.AccumulatedAmount = cont;
}
with the code above only the “edited/active” row show the result. 
and not in all rows as I need
Could you please help me.

Best answer by Naveen Boga

Hi @eddiedaco  

Accumulated total amount = (Current Row of Total Amount + Previous Row of Accumulated total amount)

For this requirement, your grid should have the soring order like (LineNbr will be like 1,2,3..etc for each record). Based on this LineNbr you can fetch the proper values for “Current Row of Total Amount” and “Previous Row of Accumulated total amount” and assign it to Accumulated total amount.

4 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • Answer
  • September 1, 2021

Hi @eddiedaco  

Accumulated total amount = (Current Row of Total Amount + Previous Row of Accumulated total amount)

For this requirement, your grid should have the soring order like (LineNbr will be like 1,2,3..etc for each record). Based on this LineNbr you can fetch the proper values for “Current Row of Total Amount” and “Previous Row of Accumulated total amount” and assign it to Accumulated total amount.


Forum|alt.badge.img
  • Jr Varsity III
  • November 10, 2021

HI Naveen,

I’m new to acumatica. Can you please share the code for this Accumulated total amount calculation.

Please do the needful.

Thank you..

Regards,

Ramya Krishna


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • November 10, 2021

Hi @ramya15  Can you please let me know what is your requirement and it will better that if you create a new question so that others can read provide you the solution.


Forum|alt.badge.img
  • Jr Varsity III
  • November 11, 2021

Hi @Naveen B ,

I have a requirement to calculate the “Cumulative completion” based  for each task of the project based on the previous “Completion” entry. 

 

Could you please guide me on this.