0

Although that PXDefault that I have defined in the DAC, works when I enter the data in the screen , it does not seem to work with an import scenario into the screen. I am importing from a CSV data provider.

It gives an error “value cannot be null” for the record that is missing a value (item-price)

Here is the DAC field:

#region ItemPrice
[PXDBDecimal()]
[PXUIField(DisplayName = "Item Price")]
[PXDefault(TypeCode.Decimal, "0.00",PersistingCheck = PXPersistingCheck.NullOrBlank)]
public virtual Decimal? ItemPrice { get; set; }
public abstract class itemPrice : PX.Data.BQL.BqlDecimal.Field<itemPrice> { }
#endregion

2 Answers2

0

I am not that familiar with Import scenarios, but if the default value in the DAC is not being triggered, then you can use the IsNull function in order to avoid any errors. This function needs to be specified in the Source Field/Value column as the image below. In you case it will be =IsNull([ItemPrice], 0)

enter image description here

Jean Claude Abela
  • 782
  • 1
  • 9
  • 26
  • Jean, I am aware of that - it is not ideal behavior. The purpose of setting the default attribute, is so that the writer of the Import Scenario, does not have to worry about nulls. – Alan Strauss Dec 08 '20 at 17:10
-1

Acuamtica Develper Support has told me that the default attribute does net get looked at in import scenarios. To me that seems like incorrect behavior.