On the Sales Order screen, I have a custom field in SOLine (UsrNSUnitCost) that is persisted to the db. I have a custom unbound “total” field in the header (UsrTotalNSCost) to show the total for that field, computed as Qty * UsrNSUnitCost for all SO Lines on the order.
My PXFormula compiles and does not have any runtime errors, but the field is zero even when there are SO Lines with amounts in the custom field.
This is the DAC field for the SOOrder table:
public sealed class AABSOOrderExt : PXCacheExtension<PX.Objects.SO.SOOrder>
{
#region UsrTotalNSCost
[PXDecimal]
[PXUIField(DisplayName = "NS Total", Enabled = false)]
public decimal? UsrTotalNSCost { get; set; }
public abstract class usrTotalNSCost : PX.Data.BQL.BqlDecimal.Field<usrTotalNSCost> { }
#endregion
}
This is the DAC field for the SOLine table:
public sealed class AABSOLineExt : PXCacheExtension<PX.Objects.SO.SOLine>
{
#region UsrNSUnitCost
[PXDBDecimal]
[PXDefault(TypeCode.Decimal, "0.00", PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "NS Unit Cost")]
[PXFormula(typeof(Mult<SOLine.orderQty, AABSOLineExt.usrNSUnitCost>), typeof(SumCalc<AABSOOrderExt.usrTotalNSCost>))]
public decimal? UsrNSUnitCost { get; set; }
public abstract class usrNSUnitCost : PX.Data.BQL.BqlDecimal.Field<usrNSUnitCost> { }
#endregion
}
The line in the grid has a value in the custom field:

The header shows zero:

One other thing. I have the header field set as Enabled = false. So why is the field editable?
I used the same formula that was used in the Acumatica training course. The only difference I can see is that my header field is unbound.
Should be so easy, but it never is.