Setting FirstPaymentDate causes strange error

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

Post Reply
bandorganman
Posts: 68
Joined: Tue Mar 03, 2020 5:23 pm

Setting FirstPaymentDate causes strange error

Post by bandorganman »

Code: Select all

IOrderItem pmts = (IOrderItem)loan.GetProperty("Payments");
                                if ((Int32)nms.PAYDATE.Year > 1900 && (Int32)nms.PAYDATE.Year < 2100)
                                {
                                    pmts.SetProperty("FirstPaymentDate", Date.Parse(nms.PAYDATE.ToShortDateString()));
                                }
                                os.ApplyChanges(order);
causes the following error:

Order42153 HUD C014
SoftPro.ClientModel.ValidationException: Value must be between -999 and 999.
---> System.Exception: Value must be between -999 and 999.

at SoftPro.ClientModel.Validations.ValidationAttribute.Validate(ValidationContext contextMode, ValidationAttribute[] constraints, ITypeDescriptorContext context, Object value)
at SoftPro.EntityModel.ValidationConstraintInstance.Check(Object value)
--- End of inner exception stack trace ---
at SoftPro.EntityModel.ValidationConstraintInstance.Check(Object value)
at SoftPro.EntityModel.EntityExecutionContext.CheckConstraints()
at SoftPro.EntityModel.EntityExecutionContext.Dispose(Boolean completed)
at SoftPro.EntityModel.EntityExecutionContext.Scope.Dispose()
at SoftPro.EntityModel.Entity`1.SoftPro.EntityModel.IEntity.SetProperty(String path, Object value)
at LoanPayments.SoftPro.OrderTracking.Client.Orders.IOrderItem.SetProperty(String , Object )
at SoftProConversion.Form1.CreateOrder() in C:\dev\SoftProConversion\SoftProConversion\Form1.cs:line 4707
Successfully connected to SoftPro Select Server

I do not quite get why. What is causing this strange error?
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Setting FirstPaymentDate causes strange error

Post by BobRichards »

This was subtle for me since I am not an industry person. The range it was complaining about (-999 to 999) is for the Order.Loans.InterimInterest.PerDiemDays field. This field only displays 2 digits (well) and that also kept me from spotting the issue quickly. In the case below, the actual value is -112 and not -11 days.
PerDiemDays.png
PerDiemDays.png (46.38 KiB) Viewed 2598 times
In this example, the "Per diem date of" field is set to "Disbursement". This will copy the "Disbursement date" (Order Information screen) to the InterimInterest.DateFrom field. By default, the InterimInterest.DateTo will be the first of the next month. Then the "First payment date" will be a month after that. The InterimInterest.PerDiemDays value is simply the difference of the InterimInterest dates. There is a validation that this value may not exceed +/- 999 - that is the validation error that is interfering with you.

You need to make sure you initialize the "Per diem from date of" dropdown selection and the dates to make sense. You should be able to model this same behavior with the Select UI.

(Updated 2/23, Bob)
Bob Richards, Senior Software Developer, SoftPro
bandorganman
Posts: 68
Joined: Tue Mar 03, 2020 5:23 pm

Re: Setting FirstPaymentDate causes strange error

Post by bandorganman »

Thanks, I will need to look at this as some orders work fine and others do not. I am only getting this error on 8 out of over 2000 orders.
Post Reply