I have a SQL View that returns data when I run a select statement in SQL Query Analyzer. I get an error that the CustomerLocationID field does not exist when I try to access the DAC.
If I remove that field, it works fine. But I need that field.
This is the DAC
#region SOShipment
[Serializable]
[PXCacheName("SOShipment SQL View")]
public class ICSSOShipmentSQLView : IBqlTable
{
#region CustomerID
[PXDBInt]
public virtual int? CustomerID { get; set; }
public abstract class customerID : PX.Data.BQL.BqlInt.Field<customerID> { }
#endregion
#region CustomerLocationID
[PXDBInt]
public virtual int? CustomerLocationID { get; set; }
public abstract class customerLocationID :
PX.Data.BQL.BqlInt.Field<customerLocationID> { }
#endregion
#region ShipmentNbr
[PXDBString(15, IsUnicode = true, IsKey = true)]
public virtual string ShipmentNbr { get; set; }
public abstract class shipmentNbr : PX.Data.BQL.BqlString.Field<shipmentNbr> { }
#endregion
}
This is the SQL View
CREATE VIEW [dbo].[ICSMCSOShipmentSQLView]
AS
SELECT
CustomerID,
ShipmentNbr,
CustomerLocationID
FROM
dbo.SOShipment
GO
When I execute SELECT * FROM [ICSMCSOShipmentSQLView] I get data in that field.

In debug, when this line fires I get an error:
foreach (ICSSOShipmentSQLView reg in SelectFrom<ICSSOShipmentSQLView>.Where<ICSSOShipmentSQLView.customerID.IsEqual<@P.AsInt>>.View.Select(this, item.FromCustomerID))
{
string test = "testing";
}

I’ve tried deleting the View in Query Analyzer, as well as EXEC sp_RefreshView ICSMCSOShipmentSQLView.
The SOShipment table shows the CustomerLocationID as nullable, int. That is how my DAC is setup too.

I checked and there are no records in that table with a null value in the field, so that is not it.
To reiterate, if I remove that field from the DAC, there is no error.
What am I doing wrong?