Hello All,
I am trying to override a DAC field “get” method. below is the original DAC field declaration:
#region AmountToComplete
public abstract class amountToComplete : PX.Data.BQL.BqlDecimal.Field<amountToComplete> { }
[PXBaseCury()]
[PXDefault(TypeCode.Decimal, "0.0", PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Cost To Complete", Enabled = false)]
public virtual Decimal? AmountToComplete
{
[PXDependsOnFields(typeof(budgetedAmount), typeof(completedAmount))]
get { return Math.Max(0, BudgetedAmount.GetValueOrDefault() - CompletedAmount.GetValueOrDefault()); }
}
#endregion
and I want to completely override it so below is what I have put in my DAC Ext:
#region AmountToComplete
public abstract class amountToComplete : PX.Data.BQL.BqlDecimal.Field<amountToComplete> { }
protected Decimal? _AmountToComplete;
[PXMergeAttributes(Method = MergeMethod.Replace)]
[PXBaseCury()]
[PXUnboundDefault(TypeCode.Decimal, "0.00", PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Cost To Complete", Visibility = PXUIVisibility.SelectorVisible, Required = false, Enabled = false, Visible = false)]
public Decimal? AmountToComplete
{
get { return Math.Max(0, this._UsrHCLForecastToComplete); }
}
#endregion
With my above override, I would expect the original code not be executed and I get the “Math.Max(0, this._UsrHCLForecastToComplete)” but when I trace, the platform executes the original codes and returns the value as per the original formula. I am running on 21R2 and the DAC is a normal BQL table.
Any help is appreciated.
Best answer by Yuriy Zaletskyy
View original