I have added a Cutom Int Field to store start and end date duration in month(s) but when I open Projects form I get this “Error: The entry form (ID: PM301000, title: Projects) cannot be automated. An error occurred during processing of the field Through Date: Index was outside the bounds of the array.”
I know the problem is caused by PXDBCalced and when I take it away it works. Can you please advise what I’m doing wrong?
Here is the field that I have added
#region UsrLGProjectDuration
public abstract class usrLGProjectDuration : PX.Data.BQL.BqlInt.Field<usrLGProjectDuration> { }
protected Int32? _UsrLGProjectDuration;
[PXDBInt()]
[PXDefault(0, PersistingCheck = PXPersistingCheck.Nothing)]
[PXDBCalced(typeof(
IIf<Where<PMProject.startDate, IsNotNull>,
IIf<Where<PMProject.expireDate, IsNotNull>,
IIf<Where<PMProject.startDate, Less<PMProject.expireDate>>,
DateDiff<PMProject.startDate, PMProject.expireDate, DateDiff.month>, Zero>, Zero>, Zero>),
typeof(int))]
[PXUIField(DisplayName = "Project Duration", Visibility = PXUIVisibility.SelectorVisible, Required = true, Enabled = true, Visible = true)]
public virtual Int32? UsrLGProjectDuration
{
get
{
return this._UsrLGProjectDuration;
}
set
{
this._UsrLGProjectDuration = value;
}
}
#endregion