Reputation: 193
Im trying to set the value of the field below to the sum of all the costs in the grid.
Ive tried using PXFormula in the DAC
[PXParent ( typeof(Select<ProjectEntry_Extension.atcProjectLinesTable,Where<ProjectEntry_Extension.atcProjectLinesTable.contractID,
Equal<Current<Contract.contractID>>>>))]
[PXFormula(null, typeof(SumCalc<ProjectEntry_Extension.atcProjectLinesTable.unPrice>))]
[PXUIField(DisplayName="Fixture Estimated Total")]
Also tried using
cache.SetValueExt<ContractExt.usrFixtureTotals>(row.UnPrice, null);
In the RowUpdated event in the BLC
Upvotes: 0
Views: 1122
Reputation: 1712
From my point, the best way to achieve this will be PXFormula and some header DAC, where results will be stored.
E.g. you'll have some DAC 'Header' with only field called 'Sum'. This field can be invisible on the screen. After that you put PXFormula on the lines to calculate 'Sum'. After that you set value to the new line on RowInserted like that:
protected virtual void RowInserted(PXCache sender, PXRowInsertedEventArgs e)
{
SomeType line = (SomeType)e.Row;
line.Value=Header.Current.Sum;
}
Upvotes: 2