I am working on a processing screen. The grid of this screen works off of a projection DAC that joins a bunch of inventory tables (INLocationStatusByCostCenter, InventoryItem, INSite, INLocation, INItemSite, and INLotSerialStatusByCostCenter). I am trying to surface the QtyAvail field. I have the respective fields in the DAC:
#region LocationQtyAvail
[PXDBQuantity(BqlField = typeof(INLocationStatusByCostCenter.qtyAvail))]
[PXUIField(Enabled = false)]
public decimal? LocationQtyAvail { get; set; }
public abstract class locationQtyAvail : BqlDecimal.Field<locationQtyAvail> { }
#endregion
#region LotSerialQtyAvail
[PXDBQuantity(BqlField = typeof(INLotSerialStatusByCostCenter.qtyAvail))]
[PXUIField(Enabled = false)]
public decimal? LotSerialQtyAvail { get; set; }
public abstract class lotSerialQtyAvail : BqlDecimal.Field<lotSerialQtyAvail> { }
#endregionMy goal is to have one general QtyAvail field that has logic that determines which actual QtyAvail to use. If the lot serial QtyAvail is null then use the location QtyAvail. That way in my view delegate (that populates my grid) can just hold the general conditions of for example "QtyAvail is greater than zero" and we can filter for a specific site/location.I have tried using all of the following at different times but nothing seems to actually populate the field in order to have a bql condition performed.
[PXDBQuantity(BqlField = typeof(IsNull<INLotSerialStatusByCostCenter.qtyAvail, INLocationStatusByCostCenter.qtyAvail>))]
[PXDBQuantity(BqlField = typeof(Coalesce<SearchFor<INLotSerialStatusByCostCenter.qtyAvail>, SearchFor<INLocationStatusByCostCenter.qtyAvail>>))]
[PXFormula(typeof(
Switch<
Case<Where<lotSerialQtyAvail.IsNull>, locationQtyAvail>,
lotSerialQtyAvail
>
))]What is the best way to do this while keeping this logic contained in the projection DAC?