Hey guys,
this is my first time playing around with views for a generic inquiry we will be requiring for a new legislation coming in.
I have used the view in a GI and it has given me the error: ‘Error: An error occurred during processing of the field Base Item Weight: Specified cast is not valid.’.
This is my view:
CREATE VIEW CBAMCalculator AS
SELECT
Inv.CompanyID,
TranLine.DocType,
TranLine.BatNbr,
Inv.InventoryID,
Orders.OrderNbr,
Line.LineNbr,
Inv. BaseItemWeight FROM [InventoryItem] AS Inv
INNER JOIN [AMMTran] AS TranLine ON Inv.[InventoryID] = TranLine.[InventoryID]
INNER JOIN [AMBatch] AS Batch ON TranLine.[DocType] = Batch.[DocType] AND TranLine.[BatNbr] = Batch.[BatNbr]
INNER JOIN [SOLine] AS Line ON TranLine.[OrderType] = Line.[AMOrderType] AND TranLine.[ProdOrdID] = Line.[AMProdOrdID]
INNER JOIN [SOOrder] AS Orders ON Line.[OrderType] = Orders.[OrderType] AND Line.[OrderNbr] = Orders.[OrderNbr]
WHERE Batch.[DocType] = 'M'
GO
This is my DAC:
#region DocType
[PXDBString(1, IsFixed = true, InputMask = "")]
[PXUIField(DisplayName = "Doc Type")]
public virtual string DocType { get; set; }
public abstract class docType : PX.Data.BQL.BqlString.Field<docType> { }
#endregion
#region BatNbr
[PXDBString(15, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Bat Nbr")]
public virtual string BatNbr { get; set; }
public abstract class batNbr : PX.Data.BQL.BqlString.Field<batNbr> { }
#endregion
#region InventoryID
[PXDBInt()]
[Inventory]
[PXUIField(DisplayName = "Inventory ID")]
public virtual int? InventoryID { get; set; }
public abstract class inventoryID : PX.Data.BQL.BqlInt.Field<inventoryID> { }
#endregion
#region OrderNbr
[PXDBString(15, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Order Nbr")]
public virtual string OrderNbr { get; set; }
public abstract class orderNbr : PX.Data.BQL.BqlString.Field<orderNbr> { }
#endregion
#region LineNbr
[PXDBInt()]
[PXUIField(DisplayName = "Line Nbr")]
public virtual int? LineNbr { get; set; }
public abstract class lineNbr : PX.Data.BQL.BqlInt.Field<lineNbr> { }
#endregion
#region BaseItemWeight
[PXDBDecimal()]
[PXUIField(DisplayName = "Base Item Weight")]
public virtual Decimal? BaseItemWeight { get; set; }
public abstract class baseItemWeight : PX.Data.BQL.BqlDecimal.Field<baseItemWeight> {}
#endregion
I generated the DAC based on members from the DB.

Original column from the InventoryItem table. ^
DAC in DAC browser:

This is my query results from SSMS and it works as expected there:

Does anyone have any ideas as to what can be causing this? I have dropped and created the view too.