This document describes the PX1055 diagnostic.
Code | Short Description | Type | Code Fix |
---|---|---|---|
PX1055 | An invalid primary key of the DAC is used. | Error | Available |
The key fields of a DAC can be defined based on the following guidelines:
- A field bound to an identity column (that is, a field that has the
PXDBIdentity
orPXDBLongIdentity
attribute) can be the only key field in the DAC. - A DAC can have one key field or multiple key fields if none of these key fields is bound to an identity column.
The code fix can do one of the following:
- Make the field bound to the identity column be the only key field in the DAC
- Make the field bound to the identity column be a non-key field, and leave all other fields untouched
- Remove the
PXDBIdentity
orPXDBLongIdentity
attribute from the field and leave all other fields untouched
public class FinCategory : PX.Data.PXBqlTable, PX.Data.IBqlTable
{
#region CategoryID
public abstract class categoryID : PX.Data.IBqlField
{
}
[PXDBIdentity(IsKey = true)] //The PX1055 error is displayed for this line.
[PXUIField(DisplayName = "Category ID")]
public virtual int? CategoryID { get; set; }
#endregion
#region CategoryCD
public abstract class categoryCD : PX.Data.IBqlField
{
}
[PXDBString(10, IsKey = true, IsUnicode = true)] //The PX1055 error is displayed for this line.
[PXUIField(DisplayName = "Category ID")]
public virtual string CategoryCD { get; set; }
#endregion
}
public class FinCategory : PX.Data.PXBqlTable, PX.Data.IBqlTable
{
#region CategoryID
public abstract class categoryID : PX.Data.IBqlField
{
}
[PXDBIdentity(IsKey = true)] //This field is the only key field now.
[PXUIField(DisplayName = "Category ID")]
public virtual int? CategoryID { get; set; }
#endregion
#region CategoryCD
public abstract class categoryCD : PX.Data.IBqlField
{
}
[PXDBString(10, IsUnicode = true)] //IsKey=true has been removed.
[PXUIField(DisplayName = "Category ID")]
public virtual string CategoryCD { get; set; }
#endregion
}