Skip to main content

Have added a custom field on the Grid(Volume) to display the volumes of the Inventory Items during transfer.

Have also created another field(Total volume) to calculate the total volume.

see below;

 

 

Kindly assist on code to calculate the sum of the volumes and be displayed on Total volume Field.

And also  please assist on- Created the Volume field as decimal(19,6). But the output is rounded off. Please share some insights on this too.

Thank you all.

Any kind of response will be appreciated.

Hi,

I suggest to try PXFormula attribute, all steps you could find in T210 courses, or another way is to develop method that will recalculates Total and invoke it in FieldUpdated and RowDeleted events


As @andriikravetskyi35 pointed out the best, easiest and most reliable option is to use PXFormula attribute on your ChildDACExt.UsrVolume field something like

the null can be replaced by any calculation for the field itself.

this will automatically take care of the aggregation of child field to the header. Also there are a few other aggregation function in Addition to SumCalc that you can find in the guide.

just be advised:

  1. I personally have a bad experience of performance degradations when you have a high traffic screen with many lines and many calculated columns (I had this on an screen with over 500 lines in each document and 60 calculated columns that I had to revise my method completely and push it to Persist)
  2. this will get the status quo of the header field and adjust for changes in the detail. So, going forward on new documents your are all set but if you need accurate and correct values on the existing documents you will need to run a SQL script to fix exiting data OR write a method an run to fix the existing documents totals OR override your document Persist method that loops through your document lines when you save and calculates the totals and updates the document totals.

Reply