Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 1.94 KB

PX1020.md

File metadata and controls

33 lines (24 loc) · 1.94 KB

PX1020

This document describes the PX1020 diagnostic.

Summary

Code Short Description Type Code Fix
PX1020 For the DAC property with the AutoNumber attribute, the string length must be greater than or equal to the PX.Objects.CS.NumberingSequence.StartNbr value. Error Available

Diagnostic Description

You can use the AutoNumber attribute on a DAC field to enable auto-numbering for the field. For autonumbering to work correctly, the length of the auto-numbered field should not be lesser than the length of a start number of numbering sequence which is specified by the StartNbr field of the PX.Objects.CS.NumberingSequence DAC.

To fix the issue, you can make the string length sufficient for auto-numbering.

The code fix puts the length value passed to the string attribute's constructor with the sufficient length. The fix applies to PXString and PXDBString attributes, and attributes derived from them. The length value is taken from the StartNbr field of the PX.Objects.CS.NumberingSequence DAC.

Example of Incorrect Code

[PXDBString(6, IsKey = true, IsUnicode = true, InputMask = ">CCCCCC")] // The PX1020 error is displayed for this line.
[AutoNumber(typeof(RSSVSetup.numberingID), typeof(RSSVWorkOrder.dateCreated))]
public virtual string OrderNbr { get; set; }
public abstract class orderNbr : PX.Data.BQL.BqlString.Field<orderNbr> { }

Example of Possible Code Fix

[PXDBString(15, IsKey = true, IsUnicode = true, InputMask = ">CCCCCCCCCCCCCCC")]
[AutoNumber(typeof(RSSVSetup.numberingID), typeof(RSSVWorkOrder.dateCreated))]
public virtual string OrderNbr { get; set; }
public abstract class orderNbr : PX.Data.BQL.BqlString.Field<orderNbr> { }