Skip to main content

I am using PXFormula to multiply a qty and cost to create a new extension field in the details of Physical Inventory Review (although I would think the specific screen wouldn’t matter.) That part is working fine. However, I then want to sum that new column’s values into a new extension field in the header. I can't get that part to work.

Here is the relevant detail code:

using PX.Data;
using System;

namespace PX.Objects.IN
{
  public class INPIDetailExt : PXCacheExtension<PX.Objects.IN.INPIDetail>
  {
        #region UsrExtBookCost
        bPXDecimal]
        cPXUIField(DisplayName="Ext. Book Cost")]

        BPXFormula(typeof(Mult<INPIDetail.bookQty, INPIDetail.unitCost>),
        typeof(SumCalc<INPIHeaderExt.usrTotalBookCost>))]
        public virtual Decimal? UsrExtBookCost { get; set; }
        public abstract class usrExtBookCost : PX.Data.BQL.BqlDecimal.Field<usrExtBookCost> { }
        #endregion
  }
}

 

Here’s the header code:

using PX.Data;
using System;

namespace PX.Objects.IN
{
  public class INPIHeaderExt : PXCacheExtension<PX.Objects.IN.INPIHeader>
  {

    #region UsrTotalBookCost

    PPXDecimal]
    {PXUIField(DisplayName="Total Book Cost")]

    public virtual Decimal? UsrTotalBookCost { get; set; }
    public abstract class usrTotalBookCost : PX.Data.BQL.BqlDecimal.Field<usrTotalBookCost> { }
    #endregion
  }
}

 

 

I feel it has something to do with the fact that these are extensions and that somehow the PXParent that is called in INPIDetail does not cover these extension.

Hi @davidrichards12   In the past I also faced the same issue. 

 

Below comment is from Acumatica support Team on the other site.

It is a known issue that SumCalc does not work as expected in PXParent DACs.

I can only recommend using graph event handlers RowSelectedor FieldSelectingto calculate the sum instead of a solution that includes DAC attributes. You can add a comment explaining the limitation of DAC attributes in the event handler if you require Acumatica ISV certification for your solution.


Thank you Naveen. I did find in Acumatica’s own code (in INPIDetail.cs) that they specifically did not use PXFormula to sum Physical Qty. There is actually a comment in their code admitting the issue.

 

But thank you for directing me to the right events to use. I appreciate the quick response.


Reply