Page 1 of 2

CoverageAmount

Posted: Wed Dec 11, 2019 5:24 pm
by shawnregan
I'm trying to write to the CoverageAmount for LoanPolicy. But it keeps telling me that Order doesn't contain a title or TitleInsuranceCalculations.

order.TitleInsuranceCalculations[1].LoanPolicy.PremiumCalculation.CoverageAmount

Re: CoverageAmount

Posted: Wed Dec 11, 2019 5:28 pm
by BobRichards
Order.Title.TitleInsuranceCalculations...

Re: CoverageAmount

Posted: Wed Dec 11, 2019 5:50 pm
by shawnregan
Thanks. I made the correction and I am getting the following error.

Cannot access member.

order.Title.TitleInsuranceCalculations[0].LoanPolicy.PremiumCalculation.CoverageAmount

Re: CoverageAmount

Posted: Wed Dec 11, 2019 5:54 pm
by BobRichards
Please post your code (and use the </> button so the tabs/spaces are preserved).

Re: CoverageAmount

Posted: Wed Dec 11, 2019 6:19 pm
by shawnregan

Code: Select all

Order.Title.TitleInsuranceCalculations[0].LoanPolicy.PremiumCalculation.CoverageAmount = Convert.ToDecimal(((LocalOrder)tState.LocalOrder).LoanPolicyCoverageAmount);

Re: CoverageAmount

Posted: Wed Dec 11, 2019 6:24 pm
by BobRichards
Ok. Very pretty.

Do you have any diagnostic results? Is this C# or a custom order rule. Are the objects null? Do you have any other information to share? I could use a dash of context to go with the code.

Re: CoverageAmount

Posted: Thu Dec 12, 2019 11:45 am
by shawnregan

Code: Select all

EXCEPTION
Method: set_Value
Error Message: Cannot access member.

Stack Trace:
   at SoftPro.EntityModel.Field`1.set_Value(T value)
   at PremiumCalculation.set_CoverageAmount(Decimal )
   at CallSite.Target(Closure , CallSite , Object , Decimal )
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
I am using C#. This is when we are opening a new order.

Re: CoverageAmount

Posted: Thu Dec 12, 2019 11:57 am
by BobRichards
Can you do it from the Select UI?

If you can do the same action in the Select UI, then try breaking down the dynamic expression on the left of the equals sign into multiple steps. I have found on multiple occasions where the DLR engine will not be able to handle "deep drilling" like this. I don't know why. As an experiment, try below and let me know if it acts any differently.

Code: Select all

var title = Order.Title
var tic = title.TitleInsuranceCalculations[0];
var lp = tic.LoanPolicy
var prem = lp.PremiumCalculation;
prem.CoverageAmount = 100000m

Re: CoverageAmount

Posted: Thu Dec 12, 2019 12:13 pm
by shawnregan
Did as you suggest and got the same results. I will try with the Select UI.

Re: CoverageAmount

Posted: Thu Dec 12, 2019 3:46 pm
by shawnregan
The fields for that section of the order are disabled for me in the SPS UI.