0
Acumatica 버전 5.00.2749에서 작업하고 있습니다.Acumatica, 오류 # 115 nullable 객체에 값이 있어야합니다.
PXDBQuantity
또는 PXDBDecimal
으로 정의 된 필드에 새 레코드를 삽입 할 수없는 Acumatica DAC가 있습니다. 삽입 할 레코드에 대해 DAC에서 주석 처리해야합니다.
이것은 SQL CREATE TABLE
문장의 것입니다.
[Qty] [float] NULL
그러나 아래의 방법 중 하나를 사용하여 기본값이 제공되는지 여부와 관계없이 동일한 오류가 발생합니다.
[Qty] [float] NULL DEFAULT 0.0
또는
아래 단편은 DAC 내지ALTER TABLE dbo.ImportTranDetail
ADD CONSTRAINT [DF_ImportTranDetail_Qty] DEFAULT ((0.0))
FOR [Qty]
.
#region Qty
public abstract class qty : PX.Data.IBqlField
{
}
protected Decimal? _Qty;
[PXDBQuantity()]
[PXDefault(TypeCode.Decimal, "0.0")]
[PXUIField(DisplayName = "Quantity", Visibility = PXUIVisibility.Visible)]
public virtual Decimal? Qty
{
get
{
return this._Qty;
}
set
{
this._Qty = value;
}
}
#endregion
다음은 레코드를 삽입하는 코드 단편입니다. 코드를 실행할 때 HasValue
은 항상 true
과 같으며 예외가 발생하지 않습니다.
ImportTranDetail lookupTranDetail = new ImportTranDetail();
...
lookupTranDetail.Qty = 1; // also tried Convert.ToDecimal(1)
if (lookupTranDetail.Qty.HasValue == false)
{
// this is never executed
throw new PXException("Oops, Qty doesn't have a value again!");
}
// Consistently getting this error when trying to insert a new record
// Error #115: An error occurred while processing the field Qty : Nullable object must have a value
try
{
Details.Cache.Insert(lookupTranDetail);
}
catch (Exception ex)
{
throw new PXException(ex.Message);
}