Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 1.68 KB

PX1021.md

File metadata and controls

43 lines (31 loc) · 1.68 KB

PX1021

This document describes the PX1021 diagnostic.

Summary

Code Short Description Type Code Fix
PX1021 The type of the DAC field attribute does not correspond to the property type. Error Available

Diagnostic Description

The DAC property field must have a field type attribute that corresponds to the type of this property. For example, if a DAC property field has the PXDBInt attribute assigned, the property must have the int? type.

The code fix changes the property type so that it corresponds to the field type attribute. You can change the field type attribute manually to make it correspond to the property type.

Example of Incorrect Code

public class SOOrder : PXBqlTable, IBqlTable
{
    public abstract class orderDate : IBqlField { }

    [PXDBInt]  // The PX1021 error is displayed for this line. 
    [PXUIField(DisplayName = "OrderDate")]
    public DateTime? OrderDate { get; set; } // The PX1021 error is also displayed for this line. 
}

Example of Code Fix

public class SOOrder : PXBqlTable, IBqlTable
{
    public abstract class orderDate : IBqlField { }

    [PXDBInt]
    [PXUIField(DisplayName = "OrderDate")]
    public int? OrderDate { get; set; } //The code fix changes DateTime? to int?. Instead, you can change PXDBInt to PXDateAndTime manually.
}

Related Articles

Bound Field Data Types