I thought I would be clever with a synchronization project. I need to know when the last time I synced the data in a INSiteStatusByCostCenter record. So I created a separate table called INSiteStatusByCostCenterTPSync. This is the DAC:
[Serializable]
[PXTable(typeof(INSiteStatusByCostCenter.inventoryID), typeof(INSiteStatusByCostCenter.subItemID), typeof(INSiteStatusByCostCenter.siteID), typeof(INSiteStatusByCostCenter.costCenterID), IsOptional = true)]
public class INSiteStatusByCostCenterTPSync : PXCacheExtension<PX.Objects.IN.INSiteStatusByCostCenter>
{
#region InventoryID
[PXDBInt(IsKey = true)]
public virtual Int32? InventoryID { get; set; }
public abstract class inventoryID : BqlInt.Field<inventoryID> { }
#endregion
#region SubItemID
[PXDBInt(IsKey = true)]
public virtual Int32? SubItemID { get; set; }
public abstract class subItemID : BqlInt.Field<subItemID> { }
#endregion
#region SiteID
[PXDBInt(IsKey = true)]
public virtual Int32? SiteID { get; set; }
public abstract class siteID : BqlInt.Field<siteID> { }
#endregion
#region CostCenterID
public abstract class costCenterID : PX.Data.BQL.BqlInt.Field<costCenterID> { }
[PXDBInt(IsKey = true)]
[PXDefault]
public virtual int? CostCenterID
{
get;
set;
}
#endregion
#region LastTPSync
[PXDBDateAndTime(UseTimeZone = true)]
[PXUIField(DisplayName = "Last Record Sync", Enabled = false)]
[PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
public virtual DateTime? LastTPSync { get; set; }
public abstract class lastTPSync : PX.Data.BQL.BqlDateTime.Field<lastTPSync> { }
#endregion
}Everything seemed to work well and, by using a projection, I can update records in this table without impacting the main INSiteStatusByCostCenter table.
However. In doing testing I received some product and tried to release an IN Receipt. I get the following error:
Invalid column name [SiteStatusByCostCenter].[LastTPSync]
A SQL trace sees that the graph is making this SQL call (which I’ve shortened):
SELECT /* IN.30.10.00, 202303D8 */TOP (1) [SiteStatusByCostCenter].[SubItemID], [SiteStatusByCostCenter].[QtyOnHand], [SiteStatusByCostCenter].[QtyNotAvail], [SiteStatusByCostCenter].[QtyAvail],
...
[SiteStatusByCostCenter].[InventoryID], [SiteStatusByCostCenter].[SiteID], [SiteStatusByCostCenter].[CostCenterID], [SiteStatusByCostCenter].[LastTPSync]
FROM [INSiteStatusByCostCenter] [SiteStatusByCostCenter]
WHERE (
...The SQL isn’t joining INSiteStatusByCostCenter to INSiteStatusByCostCenterTPSync like it should. Something is generating the SQL in a way that LastTPSync is expected to be found within the INSiteStatusByCostCenter table.
Maybe I’ve done something wrong within my declarations?