Hi , I wanted to extend my stock item end point to include Available to Ship value of Inventory Summary screen. To do so, I Create a custom view and tried to populate the field from DAC level only. So that when called from API it will resolve the BQL and fire the data to the API. I want this field for API only so I dont have any screen level events attached to this DAC field.
Below is my code
public class TSInventoryItemNIExtension : PXCacheExtension<PX.Objects.IN.InventoryItem>
{
public static bool IsActive() => true;
#region UsrAvailToShip
[PXDBDecimal]
[PXSelector(typeof(
Search<TSViewGetAvailToShip.qtyHardAvail,
Where<TSViewGetAvailToShip.inventoryID, Equal<Current<InventoryItem.inventoryID>>>>))]
[PXUIField(DisplayName = "Avail To Ship")]
public virtual decimal? UsrAvailToShip { get; set; }
public abstract class usrAvailToShip : PX.Data.BQL.BqlDecimal.Field<usrAvailToShip> { }
#endregion
}
In the above DAC TSViewGetAvailToShip is a Sql view that return a list all StockItems with QtyHardAvail from INSiteStatus table. I used PXDBScalar , PXDBCalced, PXDefault etc. But no success. With PXDBScalar , I was able to get correct data but that choked my StockItem screen with an error @P0 parameter is expected. With DBCalced , I was getting error “Specified cast is invalid”. With PXDefault no error but always 0 as value.
Please help.