Skip to content

Latest commit

 

History

History
53 lines (43 loc) · 2.84 KB

PX1095.md

File metadata and controls

53 lines (43 loc) · 2.84 KB

PX1095

This document describes the PX1095 diagnostic.

Summary

Code Short Description Type Code Fix
PX1095 A field with the PXDBCalced or PXDBScalar attribute must have an unbound type attribute, such as PXDate or PXDecimal. Error Unavailable

Diagnostic Description

A field with the PXDBCalced or PXDBScalar attribute must have an unbound type attribute, such as PXDate or PXDecimal. Otherwise, the graph cache will not be able to create the PXFieldState object which contains information about the state of the DAC field. The field state is used by many built-in features of Acumatica ERP. If the field state object does not exist, the field may be incorrectly displayed in the user interface and not supported by different features of Acumatica ERP.

To prevent the error from occurring, you should specify an unbound type attribute for the field.

Example of Incorrect Code

#region LastActivityDate
public abstract class lastActivityDate : IBqlField { }
[PXDBCalced(typeof(Switch<
		Case<Where<lastIncomingActivityDate, IsNotNull, And<lastOutgoingActivityDate, IsNull>>, lastIncomingActivityDate,
		Case<Where<lastOutgoingActivityDate, IsNotNull, And<lastIncomingActivityDate, IsNull>>, lastOutgoingActivityDate,
		Case<Where<lastIncomingActivityDate, Greater<lastOutgoingActivityDate>>, lastIncomingActivityDate>>>, 
	lastOutgoingActivityDate>), 
	typeof(DateTime))]
[PXUIField(DisplayName = "Last Activity Date", Enabled = false)]
public virtual DateTime? LastActivityDate { get; set; } // The PX1095 error is displayed for this line.
#endregion

Example of Code Fix

#region LastActivityDate
public abstract class lastActivityDate : IBqlField { }
[PXDBCalced(typeof(Switch<
		Case<Where<lastIncomingActivityDate, IsNotNull, And<lastOutgoingActivityDate, IsNull>>, lastIncomingActivityDate,
		Case<Where<lastOutgoingActivityDate, IsNotNull, And<lastIncomingActivityDate, IsNull>>, lastOutgoingActivityDate,
		Case<Where<lastIncomingActivityDate, Greater<lastOutgoingActivityDate>>, lastIncomingActivityDate>>>, 
	lastOutgoingActivityDate>), 
	typeof(DateTime))]
[PXDateAndTime]
[PXUIField(DisplayName = "Last Activity Date", Enabled = false)]
public virtual DateTime? LastActivityDate { get; set; } 
#endregion

Related Articles

PXDBCalcedAttribute PXDBScalarAttribute Ad Hoc SQL for Fields