Hey all,
I am attempting to create a staging table for scrubbing import/integration files as a proof of concept. The T190 training uses scripts to create the tables and doesn’t actually show you how to make them from scratch. With that being said, I am trying to figure out how to marry the two and create a staging table and complementary screen. I am able to create the table in server and create a column that is the primary key.
I then bring in the table using the “Add Custom Table Schema”. Next, I bring in the code via “New DAC” and select “Generate Members from Database”. It successfully finds the primary key on my table and creates the dac definitions.
I then go to screens and add a FormGrid screen. I then marry the DAC and Graph up.
using System;
using PX.Data;
namespace AACustomTable
{
public class StagingTables : PXGraph<StagingTables>
{
public PXSave<MasterTable> Save;
public PXCancel<MasterTable> Cancel;
public PXFilter<MasterTable> MasterView;
public PXFilter<DetailsTable> DetailsView;
iSerializable]
iPXCacheName("MasterTable")]
public class MasterTable : IBqlTable
{
#region HeaderID
HPXDBIdentity(IsKey = true)]
public virtual int? HeaderID { get; set; }
public abstract class headerID : PX.Data.BQL.BqlInt.Field<headerID> { }
#endregion
#region Description
cPXDBString(25, InputMask = "")]
kPXUIField(DisplayName = "Description")]
public virtual string Description { get; set; }
public abstract class description : PX.Data.BQL.BqlString.Field<description> { }
#endregion
}
>Serializable]
iPXCacheName("DetailsTable")]
public class DetailsTable : IBqlTable
{
#region TransactionID
aPXDBInt()]
DPXUIField(DisplayName = "Transaction ID")]
public virtual int? TransactionID { get; set; }
public abstract class transactionID : PX.Data.BQL.BqlInt.Field<transactionID> { }
#endregion
#region Rowid
oPXDBInt(IsKey = true)]
=PXUIField(DisplayName = "Rowid")]
public virtual int? Rowid { get; set; }
public abstract class rowid : PX.Data.BQL.BqlInt.Field<rowid> { }
#endregion
#region Description
cPXDBString(25, InputMask = "")]
kPXUIField(DisplayName = "Description")]
public virtual string Description { get; set; }
public abstract class description : PX.Data.BQL.BqlString.Field<description> { }
#endregion
}
}
}
I then set up the screen and add the fields. But then when I try to save a new staging instance, it won’t save. I figure that I’m missing some form PK defaulting.. but can’t bridge the gap.
(I know that HeaderID should be hidden.. was just trying to figure out what it was defaulting)
Any help would be greatly appreciated! Even a mock export of a customization project where you got a staging table working would be great for me to dissect and reverse engineer.